Home > Backend Development > PHP Tutorial > 求html转为pdf中文全是问号解决方法

求html转为pdf中文全是问号解决方法

WBOY
Release: 2016-06-13 12:15:11
Original
1493 people have browsed it

求html转为pdf中文全是问号解决办法

html2fpdf将简单的html转为pdf中文乱码我实在是搞不定了,换成了html2pdf
Vendor('html2pdf.html2pdf');
        $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', array(30, 20, 25, 25));
        $html2pdf->parsingCss->fontSet('DejaVuSans');
        $html2pdf->WriteHTML("

出来吧大哥

this is a test");
        $html2pdf->Output("sample.pdf",'I');
        echo "PDF file is generated successfully!";
结果出来中文汉字全是问号  
 各位大神,该怎么解决啊 实在没法子了  求大神帮帮忙吧 我实在是没辙了
------解决思路----------------------
这是因为你没有 DejaVuSans 这个字体,另外写法也有点问题
你可以参考一下他提供的样例文件 examples/utf8.php
并将 style="font-family: freeserif">
改为 style="font-family: STSongStdLight"

至于如何使用其他字体,网上的介绍很多
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template