Search code examples
phpzend-frameworkfpdffpdi

FPDF Doesn't output accents or simbols


i got a huge text in spanish, when i add it to the pdf with Write(5,$text) it outputs well but it doesn't show any accents(é,á,ó) or simbols like $ or &. i've tried using the output in UTF-8 $pdf->Output("I","Contrato",true); but still doesn't show the text like it should. Any other solution?


Solution

  • You have to decode your utf-8, like so:

    Write(5, utf8_decode($text));
    

    An alternative is using iconv(), like so:

     Write(5, iconv('UTF-8', 'iso-8859-1', $text));