Excel to PDF Chart Rendering differently on Linux environment

I’m evaluating Aspose.Cells, and testing the export to PDF feature.


Works fine on my local windows environment, but when I deploy to Heroku (which is Ubuntu Linux environment) the PDF export behaves differently.

  1. The page break setup in excel is not maintained
  2. The chart labels aren’t positioned appropriately, and seems to overflow onto the next page.
Please see screenshots of Windows environment behavior which is good and Linux environment behavior which is bad.

Hi,

Thanks for your posting and using Aspose.Cells.

When you execute your Aspose.Cells code in Linux, you need to specify fonts by placing them in a directory and setting the font directory using CellsHelper.setFontDir method.

Please also download and try the latest version: Aspose.Cells
for Java v8.6.0.3
and see if it makes any difference for you.

For better elaboration on how Aspose.Cells for Java uses TrueType Fonts( TTFs), please go through the following articles.


Thanks for the reply.


Quick question:
The new Aspose version has only one jar file: aspose-cells-8.6.0.3.jar

The old one I was using had two:
aspose-cells-8.5.1.jar
bcprov-jdk16-146.jar

Do I no longer need the second one?

Hi Syed,


Thank you for writing back.

Please note that the bcprov-jdk16-146.jar is used for encryption and decryption therefore if you are not using any of the aforesaid features then you do not need to reference this JAR file in your project. Also note that the provided revision (8.6.0.3) is a maintenance release so we provide only the Aspose.Cells JAR in an archive, if you wish to add the reference of bcprov-jdk16-146.jar in your project you can acquire it from the official release Aspose.Cells for Java 8.6.0.

Do you have any guidance on how to install on Heroku?


I’m deploying a Java Play Framework app on Heroku, and Heroku basically dynamically creates a Linux (Ubuntu) instance based on the project configuration.

So, I don’t have access to the Heroku linux instance on which to install TTF. There must be some way to configure it so it installs.
Thanks for the help guys! Setting up the font directory worked.

FYI - I figured out how to accomplish what I needed. I created a font directory in my application and pushed the whole thing to heroku. Then I used CellsHelper.setFontDir to set to that directory.

Quick question, it seems I only need to include the TTFs that I use in my excel report, ie. Calibri, and not the whole set of fonts in the C:\Windows\Fonts directory, which are a lot of fonts.

Do you recommend keeping a base set of Fonts (ie. Arial, Times New Roman, etc.)?

Hi,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is now sorted out. You only need those fonts which are needed by your PDF and you don’t need to get all the windows fonts. Please feel free to ask any other question, we will be glad to look into it and help you further.