带有特殊字符的TCPDF HTML显示空的PDF文件 [英] TCPDF HTML with Special Characters displays empty PDF file
本文介绍了带有特殊字符的TCPDF HTML显示空的PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用TCPDF库版本:5.9.011.我正在尝试将HTML布局执行为PDF.为此,我尝试使用网站
I am using TCPDF Library Version: 5.9.011. I am trying to execute HTML layout as PDF. For which I tried with example provide with the site
$html = '<h1>HTML Example</h1>
<h2>List</h2>
Some special characters: < € € € & è è © > \\slash \\\\double-slash \\\\\\triple-slash
';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I');
显然发现生成的PDF仅是默认的页眉和页脚,中间内容为空白.
Apparently found that generated PDF only default header and footer with middle content blank.
但是,如果我删除特殊字符,例如:
However if I remove special characters like:
$html = '<h1>HTML Example</h1>
<h2>List</h2>
Some special characters:
';
PDF获得$html
推荐答案
在行 $ pdf-> writeHTML
$html = utf8_decode($html);
也许
$html = utf8_encode($html);
这篇关于带有特殊字符的TCPDF HTML显示空的PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文