Exception FileNotNFoundException in converting Word to PDF after changing font folder location

Hello.
We are experiencing an issue with Aspose.Words not respecting new set of font sources.
Here is the scenario:

  1. Sets the fonts location to folderA with some fonts.
  2. Convert a Word file to PDF
  3. Change the font location to folderB with some fonts and delete folderA
  4. Convert a Word file to PDF

When we attempt to convert the same document second time, the exception got thrown. See below:

Fonts directory= /scratch/tmp/customer/1
Warning: Import of element ‘shapedefaults’ is not supported in Docx format by Aspose.Words.
Warning: Import of element ‘extraClrSchemeLst’ is not supported in Docx format by Aspose.Words.
Warning: Font ‘Abadi’ has not been found. Using ‘Arial’ font instead. Reason: font info substitution.
Fonts directory= /scratch/tmp/customer/2
Exception in thread “main” java.io.FileNotFoundException: Can’t find file: /scratch/tmp/customer/1/arial.ttf.
at com.aspose.words.internal.zz3c.(Unknown Source)
at com.aspose.words.internal.zzWlL.zzzy(Unknown Source)
at com.aspose.words.internal.zzZ0m.openStream(Unknown Source)
at com.aspose.words.internal.zzXid.zzXMZ(Unknown Source)
at com.aspose.words.internal.zzXkb.zzYDD(Unknown Source)
at com.aspose.words.internal.zzXvD.zzYDD(Unknown Source)
at com.aspose.words.internal.zzXcS.zzZMS(Unknown Source)
at com.aspose.words.internal.zzZpm.zzjA(Unknown Source)
at com.aspose.words.internal.zzWky.zzXMZ(Unknown Source)
at com.aspose.words.internal.zzXip.zzjA(Unknown Source)
at com.aspose.words.internal.zz4.zzZkg(Unknown Source)
at com.aspose.words.internal.zzc5.zzZkg(Unknown Source)
at com.aspose.words.zzZ4H.zz0Q(Unknown Source)
at com.aspose.words.zzX4H.zzXMZ(Unknown Source)
at com.aspose.words.zzXU0.zzXMZ(Unknown Source)
at com.aspose.words.Document.zzZTj(Unknown Source)
at com.aspose.words.Document.zzXMZ(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at FontFolderLocationLinux.main(FontFolderLocationLinux.java:58)

Attached are the sample program that illustrated the issue and a sample Word document.
Used Aspose.Words version 22.2 ; the issue happened in both Windows 10 and Linux OS.

Can you please let me know if this is a known issue, or if it’s a new bug?
Also if there’s a work-around - please let me know as well.
FontsFolderIssue.zip (10.4 KB)
Thank you,
Yan.

@oraspose Changing the FontSettings instance and changing the physical font files while the document is being processed is an unsupported scenario and Aspose.Words do not guarantee correct handling of the document. Exception in your case is an expected behavior. For the correct handling of changes in font settings you should reload the document after the changes being made.