Parameter is not valid. when running SlideEx.GetThumbnail(scaleX- scaleY);

I am getting this error

Source: System.Drawing
Message: Parameter is not valid.
Stack trace: 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)
at Granicus.Website.Core.SlidesHandler.ProcessRequest(HttpContext context) in c:\SFODEV01\Granicus\Feature\Ecomments\Source\MediaManager\Src\WebSite.Core\App_Code\SlidesHandler.cs:line 94

when I run this code:

string pptPath = @"C:\test.pptx";

PresentationEx presEx = new PresentationEx(pptPath);

foreach (SlideEx slide in presEx.Slides)

{

float scaleX = 640;

float scaleY = 480;

Image img = slide.GetThumbnail(scaleX, scaleY);

string documentDirectory = @"c:\temp";

string imgPath = Path.Combine(documentDirectory, slideAttachment.FileName);

img.Save(imgPath, ImageFormat.Jpeg);

}

The exception happens when the code runns this line:

Image img = slide.GetThumbnail(scaleX, scaleY);

I am using Aspose.Slides 4.0 on windows xp. This is a .Net 3.5 web applicaiton.

Please help.


Thanks,

Adam

slideAttachment.FileName is valid at this point, but the exception happens befor that anyway.

This is also happening when I run Slide.GetThumbnail for ppt documents. Not just SlideEx.GetThumbnail for pptx documents. The same exception is happening for both.

Please help me.

Hi Adam,

Please use GetThumbnail(1f, 1f) instead, that means creating image of a slide with 720x540 resolution which is the standard size of pptx slide. For more details on the same issue, visit this thread.