tcpdf 西里尔字母显示为问号“?”

发布于 2025-01-13 14:04:32 字数 1532 浏览 2 评论 0原文

我已经下载了 tcpdf,你在这里 - 我有一个问题。

简单的html代码

<p>Это тест</p>

就可以正常工作 输入图片这里的描述

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 002');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');

$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);

$pdf->SetDefaultMonospacedFont('freeserif');

$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);

$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

$pdf->setFontSubsetting(true);

$pdf->SetFont('freeserif', '', 12, '', true);

$pdf->AddPage();

//simple html being shown ok
$pdf->writeHTML('<p>Это тест</p>');

$pdf->Output('example_002.pdf', 'D');

但是当我尝试转换我的 html 页面时,西里尔字母符号被问号“?”替换。

$pdf->writeHTML($html);

输入图片此处描述

请帮忙 - 我用谷歌搜索了三天!

这是我页面的链接,您可以查看源代码 http://u1159833.cp.regruhosting.ru/co_constructor/page.php

I had downloaded tcpdf and here you are - I have a problem.

simple html code

<p>Это тест</p>

works all right
enter image description here

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 002');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');

$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);

$pdf->SetDefaultMonospacedFont('freeserif');

$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);

$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

$pdf->setFontSubsetting(true);

$pdf->SetFont('freeserif', '', 12, '', true);

$pdf->AddPage();

//simple html being shown ok
$pdf->writeHTML('<p>Это тест</p>');

$pdf->Output('example_002.pdf', 'D');

but when I try to convert my html page cyrillic symbols replaced by question marks "?"

$pdf->writeHTML($html);

enter image description here

Please help - I am googling for three days!

here is a link to my page so you can look at the source code
http://u1159833.cp.regruhosting.ru/co_constructor/page.php

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文