PDF Generation from DOCX Template Fails to Render Greek Fonts

Dear Jmix Support Team,

I’m experiencing an issue with the Reports Add-on when generating a PDF from a DOCX template containing Greek characters.

Environment: Jmix 2.6.0, Java 21, Image built with bootBuildImage (Gradle)

Problem

Although generating DOCX output from a DOCX template works fine (Greek characters display correctly), generating PDF output from the same DOCX template results in all Greek characters being replaced by #.

So far, I have tried to configure fonts using jmix.reports.pdf-fonts-directory=/workspace/BOOT-INF/classes/msttcorefonts, where the fonts were placed inside the src/main/resources/msttcorefonts directory.

image

I also tried placing the same fonts under .jmix/conf/jmix/fonts, but it had no effect.

As you can see below, it looks like the fonts are retrieved successfully when I use jmix.reports.pdf-fonts-directory in HTML to PDF conversion.

Screenshots and Logs

The DOCX template I used with Liberation Serif fonts:

image

DOCX → DOCX

Generating DOCX output with this template (for enName=Michael and grName=Μιχάλης) works correctly:

Screenshot from 2025-08-18 13-47-18

Logs:
logs_docx_to_docx_transformation.log (4.4 KB)

DOCX → PDF

Generating PDF output from the same template results in missing Greek characters:

Screenshot from 2025-08-18 13-48-34

As you can see below, the DOCX → PDF logs show warnings such as:

Font "Liberation Serif,normal,400" not found. Substituting with "any,normal,400".

and

Document font Liberation Serif is not mapped to a physical font!
No fonts configured!

Logs:
logs_docx_to_pdf_transformation.log (13.2 KB)

HTML → PDF

If I convert an HTML template with the same Liberation Serif font, PDF generation works correctly:

The html file I used: testReport20250818_html.html (1.3 KB)

The outcome:

image

According to the logs, the font family has been successfully read from the location specified with jmix.reports.pdf-fonts-directory:

025-08-18T13:52:42.877+03:00  INFO 1 --- [io-8080-exec-22] o.a.fop.fonts.apps.AbstractFontReader    : Reading /workspace/BOOT-INF/classes/msttcorefonts/Liberation_Serif_Regular.ttf...
2025-08-18T13:52:42.929+03:00  INFO 1 --- [io-8080-exec-22] o.a.fop.fonts.apps.AbstractFontReader    : Font Family: [Liberation Serif]

Logs:
logs_html_to_pdf_transformation.log (713 Bytes)

Could you please advise how to properly configure DOCX-to-PDF font handling so Greek characters render correctly?

Here is the build.gradle of my project:
build.gradle (3.2 KB)

Best regards,
Michalis

Hi,

Can you provide some sample project to minimize possible differences in test env?

Regards,
Ivan

Hi Michalis!

My apologies for the long wait for a response.

I tried to reproduce your issue using jmix 2.6.0. Exporting to PDF from DOCX works fine. The fonts are visible and work perfectly.

image

(I assume the reports add-on is already installed)
Step by step:

  1. Placed the fonts in the resources folder
    src/main/resources/liberation-font
  2. Specified the path to the fonts, relative to the resources folder, in application.properties:
    jmix.reports.pdf-fonts-directory=liberation-font
  3. Set up the report and added the same template as yours. The template has a .docx extension, and the output is a .pdf.
  4. Run the report.

I got the fonts from the /usr/share/fonts/liberation folder. In this folder, in addition to *.ttf files, there were also *.dir and *.scale files. These are used for caching and scaling on Unix-like systems. If you’re using Linux/MacOS, maybe you should try adding these files to the font folder you’re using.

Also, double-check that the placeholders for Band in your template have the correct styles. They may not have been applied (they’re marked with styles containing different fonts).
Try using the template below.
Test docx file.docx (12.2 KB)

Did you manually run the application as a WAR archive on the Tomcat web application server?
In this case, check the access rights to the font folder for the user under which Tomcat is running. (It’s possible that your user doesn’t have access to the font folder.)