Free Support Forum - aspose.com

Error 'Parameter is not valid' when using GetThumbnail on certain slide sets

Hi,

Please view the attached 3 slide test file. Slide 1 is fine, slide 2 produces error ‘Parameter is not valid’ when I try to do the following in vb.net, .net framework 2.x, Visual Studio 2005 -

Dim sz As Size
sz.Width = 512
sz.Height = 385
Dim imgF As System.Drawing.Imaging.ImageFormat

’ code ommitted for brevity - critical values are as follows
’ slide counter = 2 for 2nd slide in presentation
’ fname = slide02.jpg

’ this line throws an error on slide 2
pres.GetSlideByPosition(slidecounter).GetThumbnail(sz).Save(fname, Imaging.ImageFormat.Jpeg)

I have attached the slide set. Slide 2 is not hidden and appears to be a pretty normal powerpoint. Please take a look and let me know what I am doing wrong or what I need to do differently in order to save this successfully.

Dear kfwas,

It seems nothing wrong with your code.

It did not throw any error. I am using Aspose.Slides for .NET 2.6.26.0.

This is the code used by me and I have also uploaded the images of your presentation generated by this code.

------------------------------------------------------------------

Sub GettingThumbnails()

Dim sz As Size

sz.Width = 512

sz.Height = 385

Dim imgF As System.Drawing.Imaging.ImageFormat

Dim pres As Presentation = New Presentation("d:\downloads\SlidesThatError.ppt")

For slidecounter As Integer = 1 To pres.Slides.LastSlidePosition

Dim srcSld As Slide = pres.GetSlideByPosition(slidecounter)

pres.GetSlideByPosition(slidecounter).GetThumbnail(sz).Save("c:\Slide" & slidecounter & ".jpg", Imaging.ImageFormat.Jpeg)

Next

End Sub