java.lang.IllegalStateException: Cannot find any fonts installed on the system

Hi everyone.
I’m getting the next error converting a doc to PDF in a Linux platform:

java.lang.IllegalStateException: Cannot find any fonts installed on the system.
asposewobfuscated.qx.B(TTFontFiler.java:81)
asposewobfuscated.oa.(PalFont.java:63)
asposewobfuscated.oa.a(PalFont.java:38)
com.aspose.words.xk.Hp(SpanPr.java:346)
com.aspose.words.sl.rt(Span.java:750)
com.aspose.words.ok.k(LineFormatter.java: 209)
com.aspose.words.ok.h(LineFormatter.java: 54)
com.aspose.words.ok.g(LineFormatter.java: 44)
com.aspose.words.zy.JJ(LineBuilder.java: 237)
com.aspose.words.zy.JI(LineBuilder.java: 30)
com.aspose.words.bx.V(LinePart.java: 281)
com.aspose.words.ay.V(HeaderFooterPart.java: 154)
com.aspose.words.ahu.nG(HeaderFooterSectionLayout.java: 55)
com.aspose.words.qr.nG(StoryLayoutBase.java: 88)
com.aspose.words.mz.d(PageBuilder.java: 346)
com.aspose.words.mz.a(PageBuilder.java: 37)
com.aspose.words.ajt.b(SectionReflower.java: 40)
com.aspose.words.io.nG(MainTextSectionLayout.java: 757)
com.aspose.words.qr.nG(StoryLayoutBase.java: 88)
com.aspose.words.mx.nG(PageLayoutModel.java: 124)
com.aspose.words.zh.a(LayoutDocument.java: 33)
com.aspose.words.Document.updatePageLayout(Document.java: 1637)
com.aspose.words.Document.IF(Document.java: 1590)
com.aspose.words.Document.getPageCount(Document.java: 1618)

I’ve seen the same exception in another post and he solved the problem by installing the Times New Roman font. It did not work in my case.
Does anybody know what I’m doing wrong?

The conversion is made ok in a Windows platform.

Thank you very much for your help,

Igor Erdoiza

Hi Igor,
Thanks for your request. Please make sure you specified a folder with fonts before performing conversion to PDF. Please see the following link for more information:
https://reference.aspose.com/words/java/com.aspose.words/FontSettings
So your code should look like this:

// Specify folder where Aspose.Words will llok for fonts.
FontSettings.setFontsFolder("/usr/share/fonts", true);
// Open document.
Document doc = new Document("/home/alexey/Projects/in.doc");
// Save as PDF.
doc.save("/home/alexey/Projects/out.pdf");

Hope this helps.
Best regards,