Saving a Pdf/Docx with Aspose failed because of java 17 missing fonts in linux

331 Views Asked by At

I convert pdf file to docx on windows with JDK17 and Aspose without any problem. But when I run the same code on Linux I get this error when trying to save a PDF file as Docx using the AsposePDF/AsposeWords 23.5:

java.lang.reflect.InvocationTargetException: java.lang.InternalError
java.lang.InternalError: java.lang.reflect.InvocationTargetException
at java.desktop/sun.font.FontManagerFactory$1.run(Unknown Source)
...
… 39 more
Caused by: java.lang.NullPointerException
at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(Unknown Source)
at java.desktop/sun.awt.FontConfiguration.init(Unknown Source)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(Unknown Source)
at java.desktop/sun.font.SunFontManager$2.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.SunFontManager.(Unknown Source)
at java.desktop/sun.awt.FcFontManager.(Unknown Source)
at java.desktop/sun.awt.X11FontManager.(Unknown Source)
… 43 more

I already tried to run this command in dockerfile as suggested:

rpm install fontconfig

(where does this rpm install these files? seems like the JDK does not contain the fonts anyway)

I also tried to find fonts or fontconfig file on the Linux machine under /usr/lib/jdk and other paths but got no results.

How to handle this issue?

0

There are 0 best solutions below