I am trying to convert an entire PPTX deck into a set of thumbnail images. This works fine for PPT slides (although the code is slightly different - see at the bottom of this post), but I keep getting a cryptic error when trying to convert the PPTX slides. I googled this online, but no one really seems to have an answer. Is this a bug in the ASPOSE.SLIDES object?
My code is below:
PresentationEx presEx = new PresentationEx(sPath + Path.DirectorySeparatorChar + filename);
for (int i = 1; i < presEx.Slides.Count; i++)
{
//Accessing a slide using its slide position
SlideEx oSlideEx = presEx.GetSlideById(presEx.Slides[i].SlideId);
//Getting the thumbnail image of the slide of a specified size
Bitmap image = oSlideEx.GetThumbnail(1021, 781); //new Size(290, 230)
//Saving the thumbnail image in jpeg format
//image.Save(slideImagePath + "\\thumbnail" + i.ToString("00") + ".jpg", ImageFormat.Jpeg);
}
I get this error:
Parameter is not valid.
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at Aspose.Slides.Pptx.SlideEx.GetThumbnail(Single scaleX, Single scaleY)
Here is the code that works for normal PPT slides:
Presentation pres = new Presentation(sPath + Path.DirectorySeparatorChar + filename);
for (int i = 1; i < pres.Slides.Count; i++)
{
//Accessing a slide using its slide position
Slide oSlide = pres.GetSlideByPosition(1);
//Getting the thumbnail image of the slide of a specified size
Image image = oSlide.GetThumbnail(new Size(1021, 781)); //new Size(1021,781)
//Saving the thumbnail image in jpeg format
image.Save(slideImagePath + "\\thumbnail" + i.ToString("00") + ".jpg", ImageFormat.Jpeg);
}