我目前正在使用FPDF创建pdf,但意识到FPDF类似乎无法处理特殊字符,例如波浪号.我知道来自数据库的字符串是UTF-8,但是无论如何这些字符都会被剥离掉.我尝试过更改字符集,如下所示:
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);但是,仍然没有.除了使用tFPDF之外,还有其他解决方案吗?我已经对原始的FPDF类进行了一些实质性的更改,并且不想全部重做.
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.
谢谢 杰森
编辑
当我使用FPDF并尝试打印以下内容时:
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');它会打印出来:
Dias,Miércoles,Sábado,miércoles,A〜no
Días, Miércoles, Sábado,miércoles, A~no
推荐答案
签出名为mPDF的FPDF/HTML2PDF扩展名,该扩展名允许Unicode字体.
Checkout the extension of FPDF/HTML2PDF called mPDF that allows Unicode fonts.
www.mpdf1/mpdf/index.php
更多推荐
如何处理FPDF中的特殊字符
发布评论