Using custom font folder


I am trying to use a custom font folder, but it does not seem to work as expected. I am using Java and my OS is Windows 7.

Steps to reproduce:
- copy Arial Unicode MS from C:\Windows\Fonts to C:\CustomFonts
- delete Arial Unicode MS from C:\Windows\Fonts
- run the following code snippet:
com.aspose.cells.FontConfigs.setFontFolder(“C:\CustomFonts”, true);
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(“Blank.pdf”);
com.aspose.pdf.Table table = new com.aspose.pdf.Table();

Note that the “竤” character is not shown correctly in the PDF. I would have expected that the font file is found and used from the “C:\CustomFonts” location (if I re-install the deleted font, it is recognized and used from the C:\Windows\Fonts folder).

I am using:
aspose-cells - 9.0.0
aspose-pdf - 11.8.0

I also tried older versions of aspose-cells with the following code snippets
System.setProperty(“Aspose.Cells.FontDirExc”, “C:\CustomFonts”);
but it also does not work as expected.

Am I doing something wrong?

Thank you,


Thanks for your query with sample code.

Well, I think you are mixing the things. You are using Aspose.Pdf API to load an existing PDF to update it and save it back but you are specifying the fonts folder using Aspose.Cells APIs, you should have also used the relevant Aspose.Pdf API to specify the fonts directory at the top.

Anyways, I am moving your thread to Aspose.Pdf forum where one of my fellow colleagues from Aspose.Pdf team will help you better.

Thank you.

Hi Samuel,

Thanks for your inquiry. Please note if you want to use some custom font folder then you need to add folder in font folder lists as following.

String path = “E:/Data/Fonts/”;
List fontPaths = com.aspose.pdf.Document.getLocalFontPaths();

However you can also use a font directly from a file path as following


Please feel free to contact us for any further assistance.

Best Regards,


Works like a charm. Thank you,


Hi Samuel,

Thanks for the acknowledgement.

We are glad to hear that your requirement is accomplished. Please continue using our API’s and in the event of any further query, please feel free to contact.

I am using aspose.pdf-21.6.jar. How to set up customs fonts folder. I cannot see anything in the API. I want to run the API on Ubuntu


You can please use FontRepository.setLocalFontPaths(“fontPaths”); method offered by the API to set the custom font folder path. The required method was moved under FontRepository Class in higher/latest version(s).

Thanks… I upload microsoft fonts under /usr/share/fonts
Now i am able to get the required output. There are no more error related to Fonts. However, i still need to compare the fonts


Can you please elaborate on why and how you need to compare fonts? Please share a bit more details so that we can check related information at our end and share it with you.

I am still experiencing some issue with performance. CPU Utilization is high. Is there any mechanism by which i can increase the performance. Can we configure to use multi threading?


You can please try increasing the Java Heap Size. Also, you can surely use the API in multi-threading environment. However, please note that Aspose.PDF is a multi-threaded safe API which means you will not face any issue until one document is accessed only by one thread at a time.