OutOfMemoryError When Exporting Slides to HTML in Java (1546cnc)

Hello,

I am trying to save each slide of the attached presentation as HTML file, without success. It throws OutOfMeory Excepton for Java Heap space. Slides Java library version is 24.3, and I was able to give the java process up to 26 GB, but it did not help.
Attached s the presentation as well as the test code needed to reproduce the issue.
Fell free to ask for any additional info, if needed.
aspose.java.txt.zip (1012 Bytes)

Link to presentation file
Kind regards,
Zeljko

@Zeljko

It seems you’re encountering an OutOfMemoryException while trying to save a PPTX presentation as HTML using Aspose.Slides. Here are a few suggestions to help you resolve this issue:

  1. Increase Java Heap Size: Although you’ve already allocated 26 GB, ensure that your Java Virtual Machine (JVM) is configured correctly to utilize this memory. Verify your JVM options to confirm that the heap size is set properly.

  2. Optimize Presentation: If the presentation contains large images or complex elements, consider optimizing it by reducing image sizes or simplifying the content before conversion.

  3. Process Slides Individually: Instead of converting the entire presentation at once, try saving each slide as a separate HTML file. This can help manage memory usage more effectively. Here’s a sample code snippet to save each slide individually:

    Presentation presentation = new Presentation("your_presentation.pptx");
    for (int i = 0; i < presentation.getSlides().size(); i++) {
        ISlide slide = presentation.getSlides().get(i);
        String htmlFileName = "slide_" + (i + 1) + ".html";
        slide.writeAsHtml(htmlFileName);
    }
    
  4. Use a Different Format: If the issue persists, consider converting the presentation to a different format first (like PDF) and then to HTML, as this might reduce memory consumption.

If these suggestions do not resolve the issue, you may want to consult the Aspose documentation or community forums for further assistance.

@Zeljko,
Thank you for contacting free support. I need some time to investigate the issue. I will get back to you as soon as possible.

@Zeljko,
Thank you for your patience. I reproduced an OutOfMemoryError when converting the presentation slides to HTML with Aspose.Slides for Java 24.3, but the error does not appear with version 25.10. We recommend using the latest version of Aspose.Slides for Java.