We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Conversion produces different PDF on different platform


when converting the same Excel file with once on a Windows platform and once on a Linux platform, the results are different.

The result on Windwos seems correct, the one on Linux is completely blank.

The Excel file contains text in Calibri, a typical Windows font. I presumed that when a font was not installed on a system, like Calibri on Linux, it was substituted with some of the installed ones, thus producing a readable PDF.

What is the best way to avoid such problems and always obtain a readable, although perhaps not typographically correct PDF?

Hi Mario,

Thank you for contacting Aspose support.

The most important factor while exporting spreadsheets to PDF format is the availability of TrueType fonts (the ones used in the spreadsheet) on the machine where conversion has to take place. In case the TrueType fonts are not present (mostly unavailable in Linux based environments) you may end up with undesired results, as mentioned in your post. It is recommend that you should place the required TrueType fonts on the machine and tell the API where you have placed these fonts using the CellsHelper.setFontDir method. Please note, you should set the font directory (using the aforesaid method) at the start of your application.

In case you face any difficulty or you don’t receive desired results in the Linux environment then please share your sample spreadsheet along with environment details for further evaluation.


I tried to follow your suggestion and specified a custom folder containing the fonts. However, when a font is not found there, Aspose.Cells seems to still check in the system fonts folder, even if it is not specified with CellsHelper.setFontDir(fontFolderPath).

How can I exclude the system fonts folder from the search path?

Hi Mario,

Thank you for writing back.

If you have placed the required fonts on the machine and pointed the API to correct the directory then the API shouldn’t look for the fonts anywhere else. Please execute the following piece of code on your side with your desired sample spreadsheet. It will tell you which font is required along with the ones used in the spreadsheet.


Workbook book = new Workbook(myDir + “input.xls”);

Please also note that you do not need to install the fonts on your Linux box, instead you can simply copy the TrueType fonts from any Windows 7 platform. If you do not have a Windows 7 platform, please use these fonts, and give it another try.

I tried the following code

public static void main(String[] args) throws Exception {

new com.aspose.cells.License().setLicense( the licence path );

CellsHelper.setFontDir( a folder containing some fonts );

FileOutputStream bout = new FileOutputStream( the path to the resulting PDF );

Workbook workbook = new Workbook(new FileInputStream( the path to the XLSX ));

workbook.save(bout, com.aspose.cells.SaveFormat.PDF);



The attached XLSX uses the font Algerian which is installed in the system fonts folder but not in the folder specified in the code above.

The attached PDF is what is produced by the above code: note that the PDF contains Algerian. That is, Aspose.Cells first falls back to the system fonts folder when it cannot find the font in the specified folder.

The output of the last line is

Aspose.Cells.Font [ Calibri; 11.0; Regular; com.aspose.cells.Color@0 ]

which is confusing, since the text in the XLSX is set in Algerian.

Hi Mario,

Thank you for writing back.

It seems that you have got a correct output now.

Regarding your inquiry about the Workbook’s default font, Aspose.Cells API needs the default font (Calibri in this scenario) because it affects the scale for the cell’s width & height and page breaks in the resultant PDF. Whereas the the font in the worksheet cells (Algerian in this scenario) is used for rendering the text on PDF.

Moreover, Aspose.Cells API first checks the system’s default directory for the required fonts. In case you have set the font directory using the CellsHelper.setFontDir method then the API will check it afterwards. In terms of performance, its better that the API find all required fonts in one place.

By the way, we have executed the following piece of code against your provided spreadsheet and the latest version of Aspose.Cells for Java 8.0.2. Please note, the results produced are as expected. Attached are the fonts used as well as the resultant PDF file for your reference.


String fileName = “/home/babar/Downloads/a.xlsx”;
String out = “/home/babar/Downloads/output.pdf”;
//Set font directory; containing only Calibri and Algerian TTFs

try {
FileOutputStream bout = new FileOutputStream(out);
Workbook workbook = new Workbook(fileName);
workbook.save(bout, SaveFormat.PDF);
} catch (Exception e) {


I think you misunderstood my point. Let me explain the scenario I tested once again.

(1) The system font folder contains Algerian.

(2) The “Aspose” font folder does not contain Algerian but contains Calibri.

(3) The a.xlsx referes to Algerian.

(4) The code specifies that Aspose shall search for fonts in the “Aspose” font folder, which does not contain Algerian (see (2)).

(5) The conversion produces a.pdf which embeds Algerian even if Algerian is not in the font folder specified to Aspose.Cells.

This means that Aspose.Cells first checks if the required font is in the “Aspose” font folder specified with the invocation of CellsHelper.setFontDir().

If it does not find the font there, it then checks if it is in the system font folder. This is wrong: Aspose should only check the folder or list of folders explicitly specified (overriding any default) or there must be a way to specify that it should never check the sysem font folder.

What I expect when a font folder is explicitly given is that if a font is not there (e.g., Algerian), then it is substituted (e.g., with Calibri) without searching in the system font folder.

Is there a way to exclude the system font folder from the search path for fonts?

Hi Mario,

Thank you for elaborating the scenario.

Unfortunately, the current implementation of Aspose.Cells APIs do not provide any means to restrict the API to exclude system default font directories from it’s search for required fonts. We have logged a Feature Request in this regard under the ticket CELLSJAVA-40823, and requested the development team to check the feasibility of this feature. Please spare us little time for proper analysis of the request. In the meanwhile, we will keep you posted with updates in this regard.

OK, thanks for filing a feature request.

Excluding system default font directories from the search path is very important to obtain identical results on different platforms. The only thing one has to ensure is a properly populated Aspose font directory, totally independent from the system folder and to configure Aspose software to search only there. This is much more robust and stable than depending on the system font folder.

Hi Mario,

Thank you for writing back.

Sure, we can understand the need of your request as you have explained it. We have logged your comments to the ticket associated with this thread for better elaboration of the requested feature.


Please try our latest version/fix: Aspose.Cells for Java v8.0.2.1 (attached).

We have supported the feature.

Please add -DAspose.Cells.FontDirExc=“YourFontDir” to JVM arguments,
then Aspose.Cells will only use this font directory.

Thank you.

Thanks for the update.

However, I hope for a future API change that allows the programmer, rather than the deployer, to configure the font folder(s).

By this I mean there should be a way in the Aspose.Cells classes to specifiy the exact folders in the code and not depend on external parameters like a JVM command line argument (-D… argument to the JVM)



Hi Mario,

Thanks for your feedback and suggestion.

We recommend you to kindly apply the suggested command line to JVM while rendering your desired Excel files to PDF. And, I have logged your comments into our database and we may consider to implement your suggestion in future versions (if appropriate).

Thank you.

The issues you have found earlier (filed as CELLSJAVA-40823) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Mario,

In reference to your recent request, the developers can set the specified arguments using the System.setProperty method. Please check the below provided code snippet for elaboration.


System.setProperty(“Aspose.Cells.FontDirExc”, “FontDirSet”);

Please note, above statement should be at the start of your application, and it does not require setting the font directory using the CellsHelper.setFontDir method. Whereas the string "FontDirSet" should be the complete path to the folder containing the required fonts.

Note: Using the above approach will force the API to ignore all other font locations on the machine.


thanks very much for the update!

Hi Mario,

Please feel free to write back in case you stumble upon an issue, so we could look into it to assist you accordingly.