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.

The issues you found earlier (filed as SLIDESJAVA-39640) have been resolved in Aspose.Slides for Java 25.4 (Maven, JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.

Hi Team,

Please find the summary of test evidence with PPTX file shared with you previous Thread. We have noticed that some slide is not getting properly after applying fix (aspose.slides 25.4)
Summary_pptx_to_pdf.docx (3.8 MB)

@forasposeissues,
Thank you for the message. I’ve carefully reviewed the issues you described in the DOCX file. Regarding the slides mentioned in the document, the issues are not visible in the screenshots and are not reproduced with Aspose.Slides for Java 25.4.

I have noticed that below slide/page which had issue. Could you please double check?

  1. for Slides 4,5,9,28,36,39 i have noticed minor difference in generated pdf

Please find the generated pdf
sample_pdf.pdf (1.0 MB)

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

@forasposeissues,
Thank you for your patience. I’ve carefully compared the slides to the PDF pages. Could you please point out the issues you found?

sample.zip (1.6 MB)

All mentioned slides has minor difference when compared with generated pdf. We are highlighting because this concern was raised by QA team.

Appreciate for help.

@forasposeissues,
Could you please have your QA team point out the issues they found? It would be great if they could highlight the issues in the screenshots.

Summary_pptx_to_pdf.docx (3.8 MB)

Please check this document in which issue is highlighted.

@forasposeissues,
This is the same file you shared above. Unfortunately, I was unable to find any issues using it.

Hi Team,

Please find the document in which we have mentioned issue. Also, we have highlighted both PPTX and PDF for comparison.

  1. There seems different look & feel when pdf is compared with pptx.
  2. There are some wrong label populated in pdf (Page 36). When we compared with pptx (slide 36).

Please help to resolve issue.

Thanks
PPTX_PDF_Issue.docx (691.9 KB)

@forasposeissues,
Thank you for the screenshots.

Regarding slide 4, I was unable to reproduce the issue. Please verify carefully that you are actually using Aspose.Slides 25.4.

Regarding slides 9, 28, and 39, please note that the Citi Sans Text font is used in the presentation, but a different font appears in the PDF. This occurs because Citi Sans Text is missing from the operating system where the conversion was performed. This may also affect text placement. To resolve this, you should either install the font on the operating system or load it as an external font using the FontsLoader class, as shown below:

var folders = new String[] { "path_to_a_folder_with_fonts" };
FontsLoader.loadExternalFonts(folders);

Custom PowerPoint Font in Java|Aspose.Slides Documentation
FAQs|Aspose.Slides Documentation

Regarding slide 36, I have reproduced the issue. 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-39701

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.

Yes, checked slide 4. There is issue with generated pdf at page 4.
We are currently using Aspose.Slides.25.4

@forasposeissues,
In PowerPoint on my side, the X-axis labels on slide 4 look the same as in your screenshot of page 4 of the PDF (0, 2, 4,… 16). Also, you can upload the presentation to Office 365 and view it. It appears that PowerPoint renders slide 4 differently on your end.

The issues you found earlier (filed as SLIDESJAVA-39701) have been resolved in Aspose.Slides for Java 25.9 (Maven, JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.