Free Support Forum - aspose.com

Error in GetThumbnail() .Net

I'm getting an error 'A generic error occurred in GDI+.' when using GetThumbnail() function.

Dear myliba,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.Slides for .NET

I think, this error has been resolved already, please try the latest Aspose.Slides 2.7.7.0 from this link. If the problem still occurs then, please attach the source presentation(s).

http://www.aspose.com/Community/Files/51/aspose.slides/default.aspx

I'm getting this error even with the latest download. And i'm getting it with any presentation i try. I'm attaching attach one of them now.

What is the version of .NET Framework on your computer? Please see the system requirements from this link.

http://www.aspose.com/Wiki/default.aspx/Aspose.Slides/SystemRequirements.html

That is normal for web application with medium trust level.
System.Drawing.Imaging.Metafile class doesn’t work in such applications
so rendering slides with metafiles will throw exception.

The .Net Framework version used is 2.0.

Is there any solution for this?

As Alexey mentioned, change the trust level of your web application.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Add the following XML in your Web.config



Changing trust level also did not help. The exception is still occuring.

Try running this code as console application and let me know your findings.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Presentation srcPres = new Presentation(@"d:\downloads\demoppt.ppt");

Slide sld = srcPres.GetSlideByPosition(1);

System.Drawing.Image img = sld.GetThumbnail(1.0, 1.0);

img.Save("c:\\outImg.jpg");

Then run it as ASP.net application. Let me know which Visual Studio you are using for development? Please attach the complete project, so I can run it and check here.

Please see this link

http://www.aspose.com/Community/forums/thread/101575.aspx

I finally figured out what was the problem.

My IIS was running in medium trust level and apparently that caused the problem!!
When I changed it to run in low trust it suddenly worked. The graphs appeared!
Might be good for you to know.

Thanks for your help

As instructed I tried created a console application and then an ASP .Net application. The code snippet you provided works fine in both. I was able to generate a thumbnail.

But the ASP .Net application I was working on earlier gave the same old exception with that code. The settings of both applications are similar. Seems strange...

I'm using .Net 2.0.

Thank You very much for all the help