Fpdf and special characters
Solved
emrh
Posted messages
439
Status
Member
-
emrh Posted messages 439 Status Member -
emrh Posted messages 439 Status Member -
Hello everyone,
I'm having trouble printing certain special characters in PDF using FPDF...
For anything with accents, I have no problem using utf8_decode and
utf8_decode(utf8_encode(chr(128))) for my € symbol, but this
method doesn't work on □ and œ for example...
I've tried lots of things like:
Anyway, nothing works... In desperation, I even tried this:
http://www.fpdf.org/en/script/script4.php
but that didn't work either!
Do you have any ideas to help me?
Thank you in advance
Configuration: Linux / Chrome 99.0.4844.84
I'm having trouble printing certain special characters in PDF using FPDF...
For anything with accents, I have no problem using utf8_decode and
utf8_decode(utf8_encode(chr(128))) for my € symbol, but this
method doesn't work on □ and œ for example...
I've tried lots of things like:
utf8_decode('&squ') utf8_encode(chr(0x25A1))) utf8_encode(chr(0x25A1))) $pdf->Write(10,⃞); //& # x 2 0 d e $reportSubtitle = iconv('UTF-8', 'windows-1252', ' □ Classement'); $pdf->Cell(69,4,$reportSubtitle0,1,'L'); $pdf->Cell(5,6,utf8_decode(utf8_encode(chr(0xA1))),0,1,'L',true); Anyway, nothing works... In desperation, I even tried this:
http://www.fpdf.org/en/script/script4.php
but that didn't work either!
Do you have any ideas to help me?
Thank you in advance
Configuration: Linux / Chrome 99.0.4844.84
2 answers
-
I have a potential lead found here:
https://stackoverflow.com/questions/6334134/fpdf-utf-8-encoding-how-to
and now this line displays correctly:
$pdf->Cell(188,4,iconv('UTF-8', 'windows-1252', 'œ € é ê ô ù ...'),0,1,'L', false);
But I can't print this: □
Do you have any idea to help me? -
To conclude my request, I found a little trick for the boxes and checked boxes:
BOXES:$pdf->Cell(4,4,'',1,0,'L'); // BOX
CHECKED BOXES:$pdf->Cell(4,4,'X',1,1,'L'); // CHECKED BOX
It's worth what it's worth, but for now it solves my problem!
□ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □