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?
Asked
Active
Viewed 2,692 times
2

Fabian W
- 43
- 1
- 7
2 Answers
4
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));

schellingerht
- 5,726
- 2
- 28
- 56
-
It worked! thank you so much. I thought that with the output it should be enough but i guess it wasn't. – Fabian W Jan 27 '16 at 15:06
-
1OMG @schellingerht where have you been! 6 years this comment has been sitting here waiting for me to find it! I've struggled so much with this... utf8_decode() fixed it! – Scott Nov 29 '22 at 20:40
0
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);

Greg Venech
- 8,062
- 2
- 19
- 29

Eric Nkunda
- 1
- 2