Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Mon Apr 28, 2025 1:43 am

Hello,
We have since purchased and
I'm converting PPTX file into pdf using spire.presentation-10.1.0.(Java) My issue is Im trying to use 50MB size of file(120 Page) in conversion. But the API throws java.lang.OutOfMemoryError: Java heap space

The PPTX file is divided by section Converting to PDF. Please accept our apologies for not including the sample file due to security concerns.

>> For example.

PPTX File

Code: Select all
Section 1
      1page AAA
      2page BBB
      3page CCC
   Section 2
      4page DDD
      5page EEE
   Section 3
      6page FFF
      7page GGG
      8page HHH
   Section 4
      9page III
      10page JJJ


....



PDF CONVERTING======================================================================

Code: Select all
   1st File  pdf  Full Conversion
   2nd File  pdf  Section 2 ~ End page
   3rd  File  pdf  Section 3 ~ End page
   4th File  pdf  Section 4 ~ End page

...
* We have revised it.
PDF CONVERTING======================================================================




Code snippet looks like this:
=======================================================================================
Code: Select all
SectionList list = ppt.getSectionList();
String name = "";
ISlide indexSlide = null;
Integer[] indexSlideNumber = new Integer[list.getCount()];
String[] indexSlideName = new String[list.getCount()];
for(int i = 0; i<  list.getCount(); i ++) {
               
   name = list.get(i).getName();
   
   //find section first page by SlideId
   indexSlide = ppt.findSlide(Integer.parseInt(String.valueOf((list.get(i).getSlideIdList()).get(0))));
 
   indexSlideNumber[i] = indexSlide.getSlideNumber();
   indexSlideName[i] = name;
   logger.info("* Section indexSlideName [i] " + i +  ":" +  indexSlideName[i]);   
}


for(int i = 0; i< list.getCount(); i ++) {
   newDoc[i] = new Presentation();
               
    SlideCollection nSlide = newDoc[i].getSlides();
               
    //Remove the default slide
    nSlide.removeAt(0);
   
   if(i != list.getCount()-1) endPage = indexSlideNumber[i+1]-1;
   else {
      endPage = ppt.getSlides().size();
   }
 
   //make PPTX
   for(int j = 0 ; startPage < endPage ; j++) {
      indexSlide = ppt.findSlide(Integer.parseInt(String.valueOf((list.get(i).getSlideIdList()).get(j))));
      
      logger.info("* startPage " + i +  ":" +  startPage); 
      
      nSlide.append(indexSlide);
      startPage++;
   }
   
   startPage = endPage;
   
   pdfName = outputDirectory + indexSlideName[i]+ ".pdf";
   
   newDoc[i].saveToFile(pdfName, FileFormat.PDF);
}

ppt.dispose();

=======================================================================================

The system information is as follows.

    Red Hat Enterprise Linux 8.6
    openjdk-8u262/bin/java -Xms8192m -Xmx8192m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m
    openjdk version "1.8.0-262"


Can you please help? Thank you.

jh1005.song
 
Posts: 1
Joined: Wed Nov 20, 2024 1:03 am

Mon Apr 28, 2025 10:25 am

Hello,

Thanks for your inquiry.
We speculate that the cause of the memory overflow is that the document contains complex elements, such as high-quality images. If you can share your document with us, it may help us locate the problem faster. For privacy reasons, you can send emails to this email address [email protected]. Thanks in advance.

Sincerely,
Tommy
E-iceblue support team
User avatar

Tommy.Tang
 
Posts: 85
Joined: Mon Apr 21, 2025 7:05 am

Return to Spire.Presentation

cron