0

更新:想通了,看下面的评论

我正在尝试从 HTML 文件创建带有 mPDF 的 PDF 文件。一切都很好,但有一件事:在这个 HTML 中,我必须有一些罗马尼亚字母(șțâăîȘȚÂĂÎ 等),这些字母在导出的 PDF 文件中被转换为符号。

我如何获取 pdf 文件,例如

我的代码:

include("mpdf/mpdf.php");
//$mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0); //the 'c' is not for multilanguage
$mpdf=new mPDF('','A4','','' , 0 , 0 , 0 , 0 , 0 , 0);//this one works

$mpdf->SetDisplayMode('fullpage');

$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list

$mpdf->WriteHTML(file_get_contents('sursa.html'));

//$mpdf->Output();//we don't want to save file by hand
$mpdf->Output('output/output.pdf','F');

源文件示例:

<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

[...]

<p style="font-size: 3.2mm">
<b>I. Părțile discuției sunt:</b><br/>
<b>aaslasjf sșf asf ăîșțâ ȘȚÂĂÎ</b>

[...]

</body>
</html>

有没有人使用特殊字符(拉丁语)并且知道如何解决这个问题?非常感谢!(更新:现在可以使用,请参阅评论)

4

1 回答 1

1

确保您使用 UTF-8 对页面进行编码,或者如果您使用的是正确指定的其他字符编码。请参阅有关输入编码的 mPDF 文档。

于 2013-01-17T04:35:15.687 回答