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

Free Support Forum - aspose.com

Aspose.slides Java Exception While Converting PPT/PPTX to PNG image

While loading some PPT files; exception thrown at Presentation init only.



Code:

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

Presentation pres = new Presentation(fileName);



Slide sl = null;

BufferedImage image = null;

String s = null;



for(int slideCount = 1; slideCount
{

sl = pres.getSlideByPosition(slideCount);



s = pngFolder + pngFileName + slideCount + “.png”;

System.out.println(s);



try

{

image = sl.getThumbnail(2.0f, 2.0f);

ImageIO.write(image, “PNG”, new File(s)); // write image file

sl = null;

s = null;

image = null;

}

catch(IOException ie)

{

ie.printStackTrace();

}

}



pres = null;

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



Output:

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

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

at java.awt.image.DataBufferInt.(DataBufferInt.java:41)

at java.awt.image.Raster.createPackedRaster(Raster.java:455)

at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)

at java.awt.image.BufferedImage.(BufferedImage.java:326)

at com.aspose.slides.pf4dd765c.pf4dd765c.pbdb106a0.p6a2feef8.en.do(Unknown Source)

at com.aspose.slides.pf4dd765c.pf4dd765c.pbdb106a0.p6a2feef8.en.createDefaultRendering(Unknown Source)

at com.aspose.slides.pf4dd765c.pbdb106a0.pa2137a2a.pa2137a2a.al.int(Unknown Source)

at com.aspose.slides.pf4dd765c.pbdb106a0.pa2137a2a.pa2137a2a.al.(Unknown Source)

at com.aspose.slides.akf.do(Unknown Source)

at com.aspose.slides.PPImage.(Unknown Source)

at com.aspose.slides.Picture.(Unknown Source)

at com.aspose.slides.Presentation.do(Unknown Source)

at com.aspose.slides.Presentation.(Unknown Source)

at com.aspose.slides.Presentation.(Unknown Source)

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



Exception is showing from first line of code only (Presentation pres = new Presentation(fileName):wink:

For PPTX,



Code:

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

PresentationEx pres = new PresentationEx(args[0]);



SlideEx sl = null;

BufferedImage image = null;

String s = null;



for(int slideCount = 0; slideCount
{

sl = pres.getSlides().get_Item(slideCount);



s = pngFolder + pngFileName + (slideCount+1) + “.png”;

System.out.println(s);



try

{

image = sl.getThumbnail(2.0f, 2.0f);

ImageIO.write(image, “PNG”, new File(s)); // write image file

sl = null;

s = null;

image = null;

}

catch(IOException ie)

{

ie.printStackTrace();

}

}



pres = null;

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



Output:

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

/Users/xyz/aaaa1.png

/Users/xyz/aaaa2.png

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

at com.aspose.slides.pf4dd765c.pf4dd765c.pbdb106a0.pf4dd765c.c.do(Unknown Source)

at com.aspose.slides.pf4dd765c.pf4dd765c.pbdb106a0.pf4dd765c.c.if(Unknown Source)

at com.aspose.slides.pf4dd765c.pbdb106a0.pa2137a2a.y.if(Unknown Source)

at com.aspose.slides.pf4dd765c.pbdb106a0.pa2137a2a.y.do(Unknown Source)

at com.aspose.slides.pf4dd765c.pbdb106a0.pa2137a2a.y.do(Unknown Source)

at com.aspose.slides.ajv.do(Unknown Source)

at com.aspose.slides.bvv.if(Unknown Source)

at com.aspose.slides.bvv.do(Unknown Source)

at com.aspose.slides.bvv.do(Unknown Source)

at com.aspose.slides.bvv.do(Unknown Source)

at com.aspose.slides.TextFrameEx.do(Unknown Source)

at com.aspose.slides.AutoShapeEx.do(Unknown Source)

at com.aspose.slides.GroupShapeEx.do(Unknown Source)

at com.aspose.slides.SlideEx.do(Unknown Source)

at com.aspose.slides.SlideEx.do(Unknown Source)

at com.aspose.slides.SlideEx.getThumbnail(Unknown Source)

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



exception thrown from line image = sl.getThumbnail(2.0f, 2.0f);

Hi Atil,

I have worked with the presentation files shared and have also generated the thumbnails on my end using Aspose.Slides for Java 7.6.0 with JDK 1.6_45 in Windows 7 environment. I have observed no issue at all and for your kind reference the thumbnails are attached. I suggest you to please increase the heap size on your end as the out of memory exception correspond to less heap size and increasing heap size will work for you.

Many Thanks,

Hi Mudassir,

I am using Mac Os X-10.8.4 and Java version is 1.6.0_51.
And as suggested by you earlier; I am using aspose.slides 7.6.0 also.

For increasing heap size I have tried even with -Xms100m and -Xmx2000m; but program crashed at any time and even that time heap was around 400m or 900m.

Will you pleaase check this with Mac OS?

Hi Atil,


Thanks for sharing the additional details. I have created an issue with ID SLIDESJAVA-34079 in our issue tracking system to resolve the issue related to PPT. A separate issue with ID SLIDESJAVA-34080 has been created in our issue tracking system to further investigate and resolve the issue related to PPTX. This thread has been linked with the issue so that you may be automatically notified once the issues will be resolved.

Many Thanks,

May I know about to what time, I will get solved aspose lib?
Thanks in advance.

Hi Atil,


I have verified the issues status and regret to share that the issue is pending for investigation owing to already pending issues in the queue. I will share the feedback with you as soon as the issue will scheduled on its due turn and get resolved.

Many Thanks,

The issues you have found earlier (filed as SLIDESJAVA-34080;SLIDESJAVA-34079) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.