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

Free Support Forum - aspose.com

Linux and Windows problem

Hello, I am using Aspose cells for Java version 8.2.2

I use Aspose cells to generate PDF document.
For some reason Linux Tomcat server won't produce same results (PDF document) as Windows Tomcat server even if code is identical in both machine.

I have attached 3 documents.

Windows.pdf - document produced on windows tomcat server
Linux.pdf - document produce on Linux tomcat server
excelVersion - this excel file is being converted into PDF.


There suppose to look the same, but in Linux.pdf version whole document spanning into next page. I could setFitToPagesWide(1); but this way I can't control how document looks after it was compressed into one page width.
Main problem here is that Aspose on Linux would stretch document in width but not in length, but on windows aspose would not behave this way, would not stretch in width nor in length.
Could you please advice me why this is happening. Thanks

Kind Regards

Alikas

Hi Alikas,


Thank you for contacting Aspose support.

Most probable reason for diverse results on different environments is the availability of the required fonts on your problematic machine (Linux). Our assumptions are based on the fact that different set of fonts are embedded in your provided PDF files (please check attached snapshot & resultant PDF). Please note, Aspose.Cells APIs require the TrueType Fonts (used in the spreadsheet) to properly calculate the cell height and width for rendering purposes. In case the required fonts are not available in the environment (where conversion has to take place), the API tries to substitute the required font(s) with the available ones causing a slight change in the text style as well as in the size of cell height & width.

In order to troubleshoot this scenario further, I would request you to please download the Calibri & Tahoma TTFs available in the attached archive, extract them on any location of your Linux machine and set the font directory as stated below. Please note, you can take the same TTFs from your Windows environment as well.

Java

CellsHelper.setFontDir(“complete location to the folder containing TTF files”);
Workbook wb = new Workbook(“location to sample spreadsheet”);
wb.save(“location to resultant PDF”, SaveFormat.PDF);

Moreover, we would suggest you to go through the following articles for future reference.


Please keep us posted with updates in this regard.