java.lang.IllegalStateException: Cannot find any fonts installed on the system albeit saving to DOCX and no PDF conversion involved

Hi guys
I have this stack trace…
This happens on Linux box, but durin MailMerge and no PDF conversion is involved. Our code reads number of docx files, executes mail merge, combines them into one and save them.
The exception happens before any save attempt. This code was fine with previous versions but fails with latest 10 version

Thanks for you answer

java.lang.IllegalStateException: Cannot find any fonts installed on the
system. at asposewobfuscated.pi.a(TTFontFiler.java:106) at
asposewobfuscated.pi.a(TTFontFiler.java:35) at
com.aspose.words.n.b(AttributeConverter.java:59) at
com.aspose.words.fp$b.C(DocumentRunSplitter.java:484) at
com.aspose.words.fp$b.moveNext(DocumentRunSplitter.java:456) at
com.aspose.words.fp.a(DocumentRunSplitter.java:200) at
com.aspose.words.aof.Ud(RunWriter.java:170) at
com.aspose.words.aof.b(RunWriter.java:138) at
com.aspose.words.fp.(DocumentRunSplitter.java:77) at
com.aspose.words.aqr.a(SpanGenerator.java:225) at
com.aspose.words.fq.ak(DocumentSpanConverter.java:652) at
com.aspose.words.fq.Bl(DocumentSpanConverter.java:592) at
com.aspose.words.fq.moveNext(DocumentSpanConverter.java:167) at
com.aspose.words.fq.AH(DocumentSpanConverter.java:203) at
com.aspose.words.vk.a(LayoutDocument.java:37) at
com.aspose.words.Document.updatePageLayout(Document.java:1399) at
com.aspose.words.fi.perform(DocumentActionUpdateLayout.java:25) at
com.aspose.words.ol.execute(FieldUpdateExecutionItem.java:78) at
com.aspose.words.oo.gZ(FieldUpdater.java:91) at
com.aspose.words.oo.HA(FieldUpdater.java:78) at
com.aspose.words.ye.SD(MailMergeRegion.java:236) at
com.aspose.words.ye.a(MailMergeRegion.java:70) at
com.aspose.words.MailMerge.execute(MailMerge.java:85) at
com.aspose.words.MailMerge.execute(MailMerge.java:110)

Hi
Thanks for your request. When you execute mail merge, Aspose.Words internally calls UpdateFields method. This method in turn calls UpdatePageLayout to build page layout. This is needed to update fields that use page numbers (TOC for example). Fonts are required to build page layout.
You should just specify a folder with fonts before performing mail merge. Please see the following link for more information:
https://reference.aspose.com/words/java/com.aspose.words/FontSettings
Your code should look like this:

// Specify folder where Aspose.Words will llok for fonts.
FontSettings.setFontsFolder("/usr/share/fonts", true);

Hope this helps.
Best regards,

This still doesn’t explain why MS Word mailmerges worked in previous versions of Aspose.Words, without specifying the Fonts folder. This could suggest this more of a bug than a feature.
Specifying a font folder makes this just a little bit less portable.
Could this lead to the “output” document looking different, e.g. if the exact font name can not be found in the font directory?

Hi
Thanks for your request. If you save a document in one of Word formats (flow documents) like DOC, DOCX, RTF,WML, ODT etc, nothing will be changed, even if there is no fonts installed on your PC. You can see the difference only if render document – convert to PDF, XPS or SWF.
In the previous versions this worked without fonts because Aspose.Words was not so smart and was unable to update such fields like TOC. Current version can update almost all fields in MS Word documents and this requires updating page layout.
Best regards,