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

Free Support Forum - aspose.com

OutOfMemoryError exception- when saving PPT as PDF

I’m using Aspose slides not so long and reached this issue.

I have two same test projects with code like this:

public class Someclass{
public static void main(String[] args) throws IOException, AsposeLicenseException {
Presentation pres = new Presentation(“c:/somePPT.ppt”);
License license = new License();
license.setLicense(new FileInputStream(“c:/Aspose.Slides.lic”)); // Trial license as far.
File outputFile = new File(“c:/ooo1.pdf”);
pres.save(outputFile.toString(), SaveFormat.PDF);

And first one runs without any problems, but second throws exception:

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:133)
at com.aspose.slides.obfuscated.pk.(SourceFile:29)
at com.aspose.slides.obfuscated.ps.do(SourceFile:149)
at com.aspose.slides.obfuscated.ps.do(SourceFile:123)
at com.aspose.slides.obfuscated.ps.for(SourceFile:452)
at com.aspose.slides.obfuscated.ps.do(SourceFile:87)
at com.aspose.slides.obfuscated.ps.if(SourceFile:102)
at com.aspose.slides.obfuscated.ki.(SourceFile:17)
at com.aspose.slides.obfuscated.alj.(SourceFile:20)
at com.aspose.slides.obfuscated.ki.do(SourceFile:42)
at com.aspose.slides.obfuscated.gr.do(SourceFile:44)
at com.aspose.slides.obfuscated.sj.do(SourceFile:33)
at com.aspose.slides.obfuscated.tc.do(SourceFile:90)
at com.aspose.slides.obfuscated.aho.do(SourceFile:94)
at com.aspose.slides.obfuscated.xq.do(SourceFile:38)
at com.aspose.slides.obfuscated.jn.do(SourceFile:12)
at com.aspose.slides.obfuscated.td.do(SourceFile:12)
at com.aspose.slides.obfuscated.jn.do(SourceFile:12)
at com.aspose.slides.obfuscated.uy.do(SourceFile:83)
at com.aspose.slides.obfuscated.aho.do(SourceFile:55)
at com.aspose.slides.obfuscated.lj.do(SourceFile:57)
at com.aspose.slides.Presentation.save(SourceFile:3401)
at com.aspose.slides.Presentation.save(SourceFile:3349)
at Someclass.main(Someclass.java:21)

And I haven’t any idea why… Because projects are identical!
After I tried many fixes, found that switching to JRE instead of JDK helps.
But now I have same problem using it in main application.

I found in web that somebody discovered problem, was looking the same, but there wasn’t any right solution.
If anyone knows the way to fix it, please help!

P.S. I’m running it on Apache Tomcat 6, using jdk1.6.0_10.
Tried jai-1_1_3-lib and jai-1_1_1-lib - no difference.

Dear Ivan,

Thanks for your interest in Aspose.Slides.

I have investigated the stack trace shared by you and it seems that your heap size is not large enough to accommodate the PPT to PDF export. You may please increase the heap size to avoid this issue and hopefully things will work for you.

Thanks and Regards,

It helped! I should try it earlier, but I was confused by the fact, that it worked in certain situations, like in debug mode in tomcat, or using jre in eclipse.
Thank you!