Lucee Flying Saucer PDF Engine not support chinese ttf

Lucee Flying Saucer PDF Engine not support chinese ttf

  1. lucee extension-pdf use api addFontDirectory
resolver.addFontDirectory(fontDirectory.getCanonicalPath(), fontembed);

2.flyingsaucer addFontDirectory call addFont by 2 argument String ,boolean

for (int i = 0; i < files.length; i++) {
       addFont(files[i].getAbsolutePath(), embedded);

3.flyingsaucer addFont with 2 argument will use BaseFont.CP1252

public void addFont(String path, boolean embedded)
            throws DocumentException, IOException {
        addFont(path, BaseFont.CP1252, embedded);

reference by

should be solve by 3 argument

fontResolver.addFont(files[i].getAbsolutePath(), BaseFont.IDENTITY_H, embedded);

Don’t forget to tell us about your stack!

OS: window 10
Java Version: 11.0.11 (AdoptOpenJDK) 64bit
Tomcat Version: WildFly / Undertow - 2.2.3.Final
Lucee Version: Lucee


Can you file an issue in jira and open a PR GitHub - lucee/extension-pdf: extension that is implementing the pdf functions and tags ?

Have you tried to install all the correct fonts first to the OS, then to the of the Java runtime environment?

On Windows, install the correct fonts in the Winroot/fonts
Restart the system

Next heck the environment path, make sure that your java runtime has the correct font mappings.

On windows systems, make sure you have installed additional keyboard layouts for the languages you are having issues with, even if you do not use those languages for the UI.

After you place the fonts in the correct location restart your lucee /tomcat instance
then try again.

I am a newbie in lucee ,i don’t understand about lucee extension.
I create a sample code with index.cfm use createObject(“java”)
The org.lucee.flyingSaucerPDF-9.1.20.jar copy from lucee extension
use addFont method MingLiU-01.ttf can work

1 Like

When using chinese TTF file in classic mode, you have to write for PD4ML .

PD4ML or Lucee dont read Windows font directory.
cfdocument description in fontdirectory

But cfdocument is using “modern” by defaults Flying Saucer PDF Engine

<cfdocument format="PDF" type="classic" fontdirectory="D:\fonts">

i try chinese TTF with file can be work

1 Like

Add the jira ticket on gaia-jyh’s behalf.

Owning to my poor knowledge about Java, I’m not able to continue with the PR. Sorry.

I added a patch to the issue [LDEV-3836] add Chinese support in cfdocument pdf output with the flying saucer engine - Lucee. The Chinese fonts only render with the fontDirectory attribute. But that does not render without fontdirectory. is there any other way to render Chinese fonts without using font directory in the flying saucer engine?


I think this is a really old Java issue, not necessarily limited to lucee.

Now this issue in the flying saucer engine was solved from the PDF extension version