问题
I am currently using FPDF to create pdf's but realized that the FPDF class doesn't seem to be able to handle special characters, like tilde's for example. I know the strings coming from my database are UTF-8, but these characters get stripped out anyway. I've tried changing the character set, like this:
$myString= iconv('UTF-8', 'windows-1252', $someString);
But, still nothing. Is there any other solutions, other than using tFPDF? I've made some substantial changes to the original FPDF class and don't want to have to redo it all.
thanks jason
EDIT
When I use FPDF and try to print something like this:
$this->SetFont( 'Arial', 'B', 19 );
$this->SetLineWidth(1);
$this->Line(10,10,290 ,10);
$this->Cell(300,15,iconv("UTF-8", "CP1250//TRANSLIT",'Días, Miércoles, Sábado,miércoles, Año'),0,1,'C');
And it prints out:
Días, Miércoles, Sábado,miércoles, A~no
回答1:
Checkout the extension of FPDF/HTML2PDF called mPDF
that allows Unicode fonts.
http://www.mpdf1.com/mpdf/index.php
来源:https://stackoverflow.com/questions/23539844/how-to-handle-special-characters-in-fpdf