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

Free Support Forum - aspose.com

Performance and output quality of Cells PDF export

Dear all,

about quite some time ago I made some tests with an earlier version of Aspose.Cells for Java (2.4.2). Our Goal was to modify an existing Excel file and export it to PDF. Although I was quite impressed by functionality, speed and quality of output my company decided to postpone further tests for the time being.

Recently I reactivated my test suite and updated it to the latest Aspose.Cells version 7.7.2.

In Windows quality and speed of PDF export still is impressing, although page layout (mainly page borders) is not exactly what an Excel printout looks like. I suppose that is because of the "Evaluation" message on top of the page and by installing a valid license page layout could be better.

But when running onUnix (I trie out AIX, which would be our destination platform for production environment, as well as Linux) there are two problems:

  1. Performance
  • Export time of a one-pager
    • Windows: 3s
    • Unix: 6s
  • Export time of a 10-pager
    • Windows 10s
    • Unix: 4m !!
      --> Especially on the AIX host CPU power and memory should'nt be a problem.
  • Quality
    • Compared to Windows the fonts are smaller and much denser
    • German umlaut characters (like äöüß) are printed over by the next standard character.

    When using the old Cells version v2.4.3 both performance (only 13s on AIX for 10 pages) and quality are much better compared to v7.7.2, although there is still a difference compared to Windows.

    Are there any tweaks to enhance performance and quality with the current Cells version on Unix? Especially an export time of 4 minutes would be an absolutely no-goer for us. The same is true for the umlaut problem.

    Many thanks in advance for your assistance.

    Best regards,

    Benjamin

    Hi Benjamin,


    Thank you for using Aspose products, and welcome to Aspose.Cells support forum.

    First of all, we would suggest you to give our latest version of Aspose.Cells for Java 8.0.0 a try on your end to see if the latest build makes any difference. Moreover, your both mentioned issues 1) & 2) seems to be related to the availability of fonts on the machine where conversion is taking place. Please note, while converting the spreadsheets to PDF format the most important factor is the availability of the fonts used in the spreadsheet. Aspose.Cells API first tries to find the exact fonts on the machine, in case it does not find the required fonts, the API will try to substitute the fonts with any other available font.

    Based on the discussion as above, we would also suggest you to explicitly set the fonts directory at the start of your application. Please use CellsHelper.setFontDir(String path) method to tell the API where to look for the fonts. We hope this will make some difference

    Dear Babar,

    thank you for your answer. Changing to Rel. 8.0.0 solved the performance problem.

    But the font problem still exists - I cannot see any difference in the output when setting the font dir. Am I using the method the right way? Here's an excerpt of my code:

    public void saveCellsReportAsPdf( Workbook workbook, String outPdfPath ) throws Exception {
    // Set font dir (for Unix systems)
    CellsHelper.setFontDir(confMap.get("fontpath"));

    // Calculate formulas before PDF export
    PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
    pdfSaveOptions.setCalculateFormula(true);

    // Export
    workbook.save(outPdfPath, pdfSaveOptions);
    }

    Hi Benjamin,


    Thank you for the confirmation, and good to know that the performance related issue is resolved.

    Regarding the font related issue, it is recommended to set the font directory before invoking any object of Aspose.Cells for Java API. As you are setting the path inside a method, you are probably creating a Workbook object outside this method and passing it as a parameter. Please place the CellsHelper.setFontDir method at the start of your application. Please also confirm that the path you are providing to the said method actually contains the TrueType fonts.

    I've attached two pictures for showing the the differences in the Windows and Unix output.

    Dear Babar,

    after changing the call of the setFontDir() method to the application start the German umlaut problem has been resolved. But there's still a difference regarding font size between Windows (bigger fonts) and Unix (smaller fonts) - see my attachments.

    On both platforms I set up a directory containing only the ttf files for the Arial font I am using in the Excel report:

    -rw-r--r-- 1 tomcat tomcat 749004 17 Jan 2011 arialbd.ttf
    -rw-r--r-- 1 tomcat tomcat 561924 17 Jan 2011 arialbi.ttf
    -rw-r--r-- 1 tomcat tomcat 555884 17 Jan 2011 ariali.ttf
    -rw-r--r-- 1 tomcat tomcat 178316 14 Jul 2006 ARIALNBI.TTF
    -rw-r--r-- 1 tomcat tomcat 178864 14 Jul 2006 ARIALNB.TTF
    -rw-r--r-- 1 tomcat tomcat 179368 14 Jul 2006 ARIALNI.TTF
    -rw-r--r-- 1 tomcat tomcat 173936 14 Jul 2006 ARIALN.TTF
    -rw-r--r-- 1 tomcat tomcat 778552 11 Mai 2011 arial.ttf
    -rw-r--r-- 1 tomcat tomcat 23275812 18 Nov 2002 ARIALUNI.TTF

    Hi Benjamin,


    Good to know that another issue got resolved.

    In order to further investigate the matter of change in font size, could you please provide us the following,

    • Source spreadsheet
    • Resultant PDF generated in UNIX environment
    • TTF fonts used in the spreadsheet from the UNIX environment
    • If possible, please also provide the resultant PDF generated in Windows environment

    Based on your provided data, we will re-evaluate the issue on our end, and log appropriate tickets if required.

    Thank you for your cooperation.

    Dear Babar,

    please find attached the requested files.

    Best regards,

    Benjamin

    Hi Benjamin,


    Thank you for providing the samples.

    We have checked both PDF files. The one generated on UNIX platform surely has text in smaller font size as compared to the one generated in Windows. We have also checked the both PDF files contain the same set of embedded fonts. Moving forwards, we will also require the sample spreadsheet (not found in the attached archive) so we could generate PDF files in different environments on our end.

    Dear Babar,

    please see my new attachment for the XLSX source file.

    Best regards,

    Benjamin

    Hi Benjamin,


    Thank you for providing the source spreadsheet.

    We have prepared Ubuntu environment (AIX environment isn’t readily available) to evaluate the font size related issue on our end. We will shortly respond back with our test results in this regard.

    Hi Benjamin,


    Thank you for your patience.

    We are able to replicate the problem of reduced font size in Aspose.Cells generated PDF files on Linux Fedora 20 platform. To probe further into this matter, we have logged an investigative ticket under Id CELLSNET-42545, and requested the development team to analyze the problem cause. Please spare us little more time for proper analysis. As soon as we have some updates in this regard, we will post here for your kind reference.

    Hi again,


    We have further analyzed the problem of the reduced font sizes in the Aspose.Cells API generated PDF files on Linux platform. Problem is caused due to the unavailability of spreadsheet’s default font in the Linux environment. Please note, Aspose.Cells API requires the base/default font in order to calculate the width and height of the cells while rendering the spreadsheets to other formats such as PDF. You may confirm with the following lines of code that the default font of your provided spreadsheet is Calibri. Once you add the Calibri font(s) to your Unix/Linux environment and point the API to the directory containing Calibri as well as the Arial TrueType fonts, you will get the same results as of in Windows environment. Attached to this post is the PDF generated on Linux Fedora 20. Also attached is the set of Calibri fonts used for rendering the attached PDF.

    Sample code to detect the base/default spreadsheet font is as follow,
    Java

    Workbook workbook = new Workbook("/home/babar.raza/Downloads/test_report.xlsx");
    System.out.println(workbook.getDefaultStyle().getFont().getName());

    Please feel free to write back in case you need our further assistance with Aspose.Cells API.

    Dear Babar,

    yes, the default font for the workbook really was Calibri although all cells in my worksheet were set to the Arial font.

    Switching the default font to Arial (Excel: Page layout -> Design -> Change font) resolved the problem. Many thanks for your solution.

    Finaly there's one last question: As mentioned in my first post the PDF and Excel printouts do not exactly match regarding zoom factor and page borders. My assumption was that this would be resolved by installing a valid licence (hence getting rid of the evaluation message). Is this correct?

    Best regards,

    Benjamin

    Hi Benjamin,


    Thank you for the confirmation.

    Regarding the zoom factor and page borders, we would suggest you to get a 30 days temporary license in order to evaluate Aspose.Cells APIs without any restriction. In case the licensed product does not produce desired results, we can quickly look into it to provide further guidance.

    Please keep us posted with updates in this regard.

    Hi Benjamin,


    Just to inform you that we have evaluated your presented scenario regarding the borders in the Aspose.Cells generated PDF files. We have analyzed the PDF while zooming the document to 200% and have found no problems with the border except the border width is somehow little thinner than the one generated with MS Excel application.

    Could you please feed us back with results on your end?