Some Unicode characters cannot be printed in PrinceXML

341 Views Asked by At
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. In CSS my font is font-family: serif !important;. Because of the error above Prince can't generate a PDF file.

2

There are 2 best solutions below

0
Salim Ibrohimi On BEST ANSWER

As I found out Times New Roman is the default serif font in PrinceXML, and it cannot print control characters (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).

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

internal error: Unable to find any available fonts.

It appears that the system you're running Prince on does not have any fonts installed. Since this is not usually possible on Windows or macOS systems I imagine you're on a UNIX-like system. I'd suggest installing the Liberation fonts to get started. E.g. fonts-liberation2 package on Debian/Ubuntu.