Free Support Forum -

RTF to PDF Creation on Linux Problem (set Font Folder as Linux Path not possible)


I have the problem to create a PDF document from RTF on linux.
Setting the font folder to a linux file system path (by using FontSettings.setFontsFolder()) is not possible, because our solution is running on a portal and we have not the chance to guarantee that a font folder exists on the server and that we can read from it.

The rtf documents that we use is read from ear package (ear Path).
Is there a solution that we:
- can that the font path to ear?
- can read the needed fonts one by one from ear?
- can that a jar (which includes all fonts) as font path?

Best regards
Randolf Kastenmaier

Hi Randolf,

Thanks for your request. You can include the font’s folder into your application. In this case, you can guaranty that it is present.

Also, in the next version behavior of Aspose.Words will be changed a bit. Currently Aspose.Words throws if cannot find any fonts. The next version will not throw. Aspose.Words will select the fonts according to the following process:

1. Aspose.Words tries to find the required font among the fonts embedded in the original document. Some document formats such as DOCX can contain embedded fonts.

2. Next, Aspose.Words tries to find a font on the file system with an exact font name match.

3. If Aspose.Words cannot find a font with the exact name match, Aspose.Words attempts to select the most suitable font from all of the available fonts.

4. Finally, if Aspose.Words cannot find any fonts on the file system, it renders the document using the free Gentium font that is embedded into the Aspose.Words assembly.

Best regards,