简体   繁体   English

某些 Unicode 字符无法在 PrinceXML 中打印

[英]Some Unicode characters cannot be printed in PrinceXML

page 6: warning: no font for Basic Latin character U+000B, fallback to U+2BD1 ⯑
page 6: warning: Ensure fonts are available on the system or load them via a @font-face rule.
page 6: warning: For more information see:
page 6: warning: https://www.princexml.com/doc/help-install/#missing-glyphs-or-fonts
internal error: Unable to find any available fonts.

Hello guys.大家好。 I'm getting the warnings/errors above when converting HTML to PDF using PrinceXML.使用 PrinceXML 将 HTML 转换为 PDF 时,我收到了上述警告/错误。 In CSS my font is font-family: serif;important;在 CSS 我的字体是font-family: serif;important; . . Because of the error above Prince can't generate a PDF file.由于上面的错误,Prince 无法生成 PDF 文件。

internal error: Unable to find any available fonts.内部错误:找不到任何可用的 fonts。

It appears that the system you're running Prince on does not have any fonts installed.您运行 Prince 的系统似乎没有安装任何 fonts。 Since this is not usually possible on Windows or macOS systems I imagine you're on a UNIX-like system.由于这在 Windows 或 macOS 系统上通常是不可能的,我想你在一个类 UNIX 系统上。 I'd suggest installing the Liberation fonts to get started.我建议安装Liberation fonts以开始使用。 Eg fonts-liberation2 package on Debian/Ubuntu.例如,Debian/Ubuntu 上fonts-liberation2 package。

As I found out Times New Roman is the default serif font in PrinceXML , and it cannot print control characters (0000-000F) .正如我发现Times New RomanPrinceXML中的默认衬线字体,它不能打印控制字符 (0000-000F) So I just remove the control characters from a string before passing it to the PrinceXML as was suggested in this SO question (take a look at the accepted answer).所以我只是在将字符串传递给 PrinceXML 之前从字符串中删除控制字符,正如这个SO question中所建议的那样(看看接受的答案)。

$string = preg_replace('/[\x00-\x1F\x7F]/u', '', $string);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM