I’m building a server for converting excel,word and ptt to pdf type.
My server belongs to AWS and his operating system in Linux.
I want to set in my projects custom fonts which was downloaded by me before.
Aspose.Words -
Everything is fine, I’ve used -
FontSettings.getDefaultInstance().setFontsFolders(new String[] { “/usr/share/fonts/”,"/usr/share/wine/fonts/"}, true);
and it works.
Aspose.Cells -
I’ve used - FontConfigs.setFontFolders(new String[] { “/usr/share/fonts/”,"/usr/share/wine/fonts/"}, true);
but the font is not changed.
Aspose.Slides -
I’ve used - FontsLoader.loadExternalFonts(new String[] { “/usr/share/fonts/”,"/usr/share/wine/fonts/"});
before any Presentation object creation as mentioned in its documentation
Class for loading custom fonts defined by user. Should be used before creating any presentation objects.
but the font is not changed and is not displayed propery.
Can someone help me? Am I missing something? I haven’t found a solution in the forums.
You are facing this issue due to missing fonts. You need to install fonts that are used in your document on the machine where you are exporting document to PDF. Please read the following articles. Using Custom Fonts without Installing them
The fonts were successfully installed on my linux server because currently it works for Aspose.Words.
on the same code and on the same machine, Aspose.Words works but Aspose.Cells and Aspose.Slides don’t work.
Do I need to set something else for Cells and Slides?
for Words, the code line I’ve mentioned is enough, but for Cells and Slides isn’t enough.
Could you please ZIP and attach your input and problematic output documents here for testing? We will investigate the issue and provide you more information on it.
Ok, tomorrow I’ll attach the zip, for now I’ll clarify my issue.
It’s important to mention that I’ve installed on my Linux server msttcorefonts which includes many standard fonts in ‘/usr/share/fonts’ and in ‘usr/share/wine/fonts’ paths.
By saying ‘it does NOT work’ I mean to the fact that the installed fonts from the specified folder aren’t respected, and the default/custom aspose fonts are displayed only.
Please move the following line of code from your code segment at the top: FontConfigs.setFontFolders(new String[] { "/usr/share/fonts/","/usr/share/wine/fonts/"}, true);
Please note, the fonts setting API should be processed first and should be used before using any other Aspose.Cells APIs. Also, currently, Aspose.Cells only supports .ttf and .ttc font files. The .otf font files are not supported yet.
We have tested the scenario using the latest version of Aspose.Cells for Java 19.5 and Aspose.Slides for Java 19.4. We have not found the shared issue with output PDF files. Please check the attached output PDF files.
We have noticed that you are generating the PDF files using Aspose.PDF. You can export Excel and Presentation files to PDF without using Aspose.PDF. If you still face problem, please ZIP and attach the fonts used in your documents (.xlsx and .pptx) here for further testing. We will investigate the issue and provide you more information on it.