Search code examples
javapdfdocxdocx4jxdocreport

How to change font encoding when converting docx -> pdf with docx4j?


When I'm a converting docx document to pdf my national characters transform into "#" marks.
Is there any way to set a font encoding for pdf documents?

I used xdocreport in the past and it can handle that, but I had problems with images, headers and footers.

Docx4j manages to do this, but not fonts. After conversion, fonts have ANSI encoding while I'd like to have windows-1250. Is there an option to set this?


Solution

  • My problem was - missing proper True Type Fonts on linux server. The default fonts where inserted instead (without my code pages).

    I solved the problem installing the default Ms Windows fonts via ttf-mscorefonts-installer

    On debian:

    apt-get install ttf-mscorefonts-installer