Reputation: 43
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?
Upvotes: 2
Views: 3414
Reputation: 21
The code below helped after I spent many hours searching for a hint...
setlocale(LC_CTYPE, 'en_US');
$val = iconv('UTF-8', 'iso-8859-1', $variable_containing_special_chars);
$pdf->Cell(x_axis,y_axis,$val);
Upvotes: 0
Reputation: 5796
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));
Upvotes: 5