While Converting PPTX to PDF in Java, Charts Are Not Rendered Properly

Hi Team,

We are trying convert PPT document into PDF. But, charts from ppt are not rendered correctly in PDF.
In PDF chart images got distorted dramatically.
Java Version :17
We are using aspose.slides version 24.7
Linux version : 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Wed Sep 11 18:02:00 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux

Attached PPT file here along with few sample images of affected charts from pdf.
please suggest.

File pptFile = new File("pptFilePath");
try (FileInputStream fileInputStream = new FileInputStream(pptFile)) {
	logger.info("initilizatize fileInputStream for the ppt document");
	Presentation ppt = new Presentation(fileInputStream);
	logger.info("initilizatize presensentation object");
	ppt.getDocumentProperties().setTitle("SampleTitle");
	ppt.save(outputPdfFilePath,SaveFormat.Pdf,pdfOptions); //This ppt.save method takes more 5 mins to execute.
}
catch (Exception e) {
//
}

New folder.zip (1.8 MB)

@forasposeissues

It seems you are experiencing issues with chart rendering when converting a PowerPoint presentation to PDF using Aspose.Slides. Distorted charts can often be attributed to various factors, including the complexity of the charts, the version of Aspose.Slides being used, or specific settings in the conversion process.

Here are a few suggestions to help you troubleshoot and potentially resolve the issue:

  1. Update Aspose.Slides: Ensure you are using the latest version of Aspose.Slides. As of your current version (24.7), there may have been updates or bug fixes in later versions that address chart rendering issues.

  2. Check Chart Types: Some chart types may have specific rendering issues. If possible, try simplifying the charts or using different types to see if the problem persists.

  3. Adjust PDF Options: When saving the presentation to PDF, you can customize the PdfOptions to improve the output quality. For example, you can set the JpegQuality or TextCompression properties to enhance the rendering of charts.

    Here’s an example of how to set PDF options:

    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.setJpegQuality(100); // Set JPEG quality to maximum
    pdfOptions.setTextCompression(TextCompression.Flate); // Use Flate compression for text
    ppt.save(outputPdfFilePath, SaveFormat.Pdf, pdfOptions);
    
  4. Validate Chart Layout: Before saving the presentation, you can validate the layout of the charts to ensure they are rendered correctly. This can be done using the ValidateChartLayout method.

    Example:

    for (ISlide slide : ppt.getSlides()) {
        for (IShape shape : slide.getShapes()) {
            if (shape instanceof IChart) {
                ((IChart) shape).validateChartLayout();
            }
        }
    }
    
  5. Test on Different Environments: Since you are using Linux, it might be worth testing the conversion on a different operating system (like Windows) to see if the issue is environment-specific.

  6. Review Sample Files: If you have access to other PPT files with charts that render correctly, compare them with the problematic file to identify any differences in chart configuration.

If the issue persists after trying these suggestions, consider reaching out to Aspose support with detailed information about the charts and the specific problems you are encountering. Providing sample files can also help in diagnosing the issue more effectively.

Feel free to ask if you have any further questions or need additional assistance!

@forasposeissues,
I need some time to check the issue. I will get back to you soon.

@forasposeissues,
I’ve reproduced the problem with the charts when converting the PowerPoint presentation to a PDF document.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39640

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.