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

Free Support Forum - aspose.com

Having issues with pdf files on unix platform

Hi,


We recently got license for
We are using aspose-cells-7.7.2.jar file to generate XLSX file.
We create basic template on top of that we run some java logic to populate the data on to the template.
We generally create XLSX and pdf files from the template using aspose-cells-7.7.2.jar.
Everything works fine in windows environment but we had some issues facing at the time of creating pdf files on unix environment.
Formatting and line/page break problems are happening.
For example my XLSX template file has 5 pages, when we generate pdf we are seeing content is spread across 12 pages.

I am not sure is it because of environment or with the template itself.


Thanks
Venkata.

Hi Vekanta,


Thank you for contacting Aspose support.

Upon reviewing your presented scenario, it seems that the problem could be related to the availability of TrueType fonts in your Unix environment. Please note, Aspose.Cells APIs need TTF fonts to be present on the machine where conversion is taking place. Moreover, Aspose.Cells APIs need these fonts to calculate the cell width and height while rendering the results to PDF format.

It is suggested that you first install the TTF fonts used in your spreadsheet, and explicitly tell the API where to look for the fonts while using the CellsHelper.setFontDir factory method. You may also check which basic font is required by executing the below piece of code, and manually make sure the font(s) is present on the specified path.

Java

System.out.println(book.getDefaultStyle().getFont());

Please feel free to write back in case you need our further assistance.

Hi Babar,


Thanks for your reply.

When I execute book.getDefaultStyle().getFont() in my Java program I get the following output:

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

But in our template we are using only Arial Narrow font.

Should I assume that I need Calibri font in my Linux server?

Do you know how to install fonts in Linux?

Thanks.

Hi Venkata,


Thank you for writing back.

Yes, you need Calibri as well as Arial Narrow TTF fonts to be present in your Linux environment. Please find the attachment for an archive containing both type of fonts from my Windows 7 Home Premium platform. Place them in any directory, and point the CellsHelper.setFontDir method to its correct location. Please note, you should set the fonts directory at the start of your application. Hopefully this will resolve the problem.

In case the problem persists, please provide the template spreadsheet along with your environment details so we could simulate your environment before re-evaluating the presented scenario. We are interested in flavor & version of Linux you are using and JDK type & version.

Thanks for your reply. We placed the TTF files in the Unix box and the PDF is coming properly.

Hi Venkata,


Good to know that you are up and running again. Please feel free to write back in case you need our further assistance with Aspose.Cells APIs.