Error while extracting image as thumbnail from slideEx object

Hi,


Can you kindly guide me on how to extract a thumbnail image of a Slide using a slideEx object.

I am getting the following error when extracting the thumbnail:

class com.aspose.slides.pf4dd765c.pbdb106a0.dg: Cannot access a disposed object.
Object name: ‘MemoryStream’.
com.aspose.slides.pf4dd765c.pbdb106a0.pa5e0ff62.ad.int(Unknown Source)
com.aspose.slides.pf4dd765c.pbdb106a0.pa5e0ff62.ad.setPosition(Unknown Source)
com.aspose.slides.pf4dd765c.pbdb106a0.pa2137a2a.aj.do(Unknown Source)
com.aspose.slides.SlideEx.getThumbnail(Unknown Source)

The error I am getting is in the code marked as bold. The code that I am using is as follows:
try {
// retrieve image
TiffOptions tiffOp = new TiffOptions();
tiffOp.setDpiX(300);
tiffOp.setDpiY(300);
tiffOp.setImageSize(new Dimension(Integer.parseInt(chartWidth), Integer.parseInt(chartHeight)));
// tiffOp.setCompressionType(TiffCompression.CCITT_3);
BufferedImage chartImage = sld.getThumbnail(tiffOp);
// File outputfile = new File(“D:\output\image\tiffsaved.tiff”);
// ImageIO.write(chartImage, “png”, outputfile);
} catch (Exception e) {
logger.info(“Exception:” + e.getMessage());
}

My aim is to get a 300 dpi image with a size of 800 X 600.

Thanks,
Gaurang.

Hi Gaurang,

I have observed the issue shared by you and request you to please try using Aspose.Slides for Java 8.4.0 on your end. If there is still an issue then please share the source presentation, Operating system and Java details with us. I will investigate the issue further on my end to help you out.

Many Thanks,

Hi Mudassir,


Thank you for your quick reply. I am using the latest version of Aspose i.e. 8.4.0. The operating system is Windows 7 and the java version is jdk1.7. Attaching the source presentation for your reference.

Thanks,
Gaurang

Hi Gaurang,

I have worked with the sample presentation shared by you and have been able to observe the issue specified. An issue with ID SLIDESJAVA-34296 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

I have also verified that when the Tiff for slide is generated on presentation level then there is no issue. Therefore, I have generated the code sample for workaround approach for your convenience that you may use on your end for the time being to serve the exact purpose your are looking for.

public static void genTiff(String presName,String path ) throws Exception
{
try{
// String path=“D:\Aspose Data\”;
PresentationEx pres = new PresentationEx(path+presName);

PresentationEx target= new PresentationEx();

TiffOptions tiffOp = new TiffOptions();
tiffOp.setDpiX(300);
tiffOp.setDpiY(300);
tiffOp.setImageSize(new Dimension(720,440));

int count =pres.getSlides().getCount() ;
for(int i=0;i<count;i++)

{
target= new PresentationEx();
SlideExCollection slides=target.getSlides();

SlideEx sld = pres.getSlides().get_Item(i);
int id=slides.addClone(sld);
target.getSlides().removeAt(0);
target.save(path+“Slides/PPTX_thumbnail “+i+”.tiff”,SaveFormat.Tiff,tiffOp);


}

}
catch(Exception e)
{
e.printStackTrace();
}
}

Please share, if I may help you further in this regard.

Many Thanks,

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


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