Could not find any font error on linus

Hi


My web app runs well on windows (dev machine), but it stop working on centos env. I got these error messages:

com.aspose.ms.System.e: Could not find any font. Use Document.addLocalFontPath(String path) to set correct path for your fonts location.
at com.aspose.pdf.b.c.g.c.p.a(Unknown Source)
at com.aspose.pdf.b.c.g.c.p.populateMaps(Unknown Source)
at com.aspose.pdf.b.c.g.c.p.dcS(Unknown Source)
at com.aspose.pdf.b.c.g.c.p.dcR(Unknown Source)
at com.aspose.pdf.ADocument.preSave(Unknown Source)
at com.aspose.pdf.ADocument.saveInternal(Unknown Source)
at com.aspose.pdf.Document.saveInternal(Unknown Source)
at com.aspose.pdf.ADocument.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)

Can anyone help me?

Regards,
Green

Hi Green,


Thanks for your inquiry. The mentioned error issue arises with Non-Windows OS(Linux/MAC) due to the font folder path setting. Please set font folder as following before any operation. Hopefully it will help you to resolve the issue.

You can use following methods to get system folder of fonts or set font path to font folders. Hopefully it will help you to fix the issue.

Document.getLocalFontPath () - shows the system folder in which project will look for fonts.
Document.setLocalFontPath (String) - Setting font path to custom folder

//adding a new font path<o:p></o:p>

String path = “c:\fonts\”;<o:p></o:p>

com.aspose.pdf.Document.addLocalFontPath(path);<o:p></o:p>


Moreover please also check following code snippet to set font path if there are more than one font path.


//geting the list for standard font directories in different OS<o:p></o:p>

java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();<o:p></o:p>

//seting the user list for standard font directories<o:p></o:p>

list.add(“c:\fonts2\”);<o:p></o:p>

list.add(“c:\fonts3\”);<o:p></o:p>

com.aspose.pdf.Document.setLocalFontPaths(list);<o:p></o:p>

//Restoring list for standard font directories by default.<o:p></o:p>

com.aspose.pdf.Document.restoreLocalFontPath();<o:p></o:p>

<o:p> </o:p>

<o:p>Please feel free to contact us for any further assistance.</o:p>

<o:p>
</o:p>

<o:p>Best Regards,</o:p>