Adding image to PDF - results in exception: A generic error occurred in GDI+

Hi,



Could anyone please tell me what I’m doing wrong:



I can easily create PDF documents from my Windows Form application, but when I try to add images to the PDF document I simply get an System.Runtime.InteropServices.ExternalException with the message: A generic error occurred in GDI+, e.g.:





FileStream imageStream = new FileStream(@“c:\temp\aspose-logo.jpg”, FileMode.Open);



doc.Pages[1].Resources.Images.Add(imageStream);





will die on the second line. I’ve even tried using a stamp:



var imageStamp = new ImageStamp(@“c:\temp\aspose-logo.jpg”)

{

Background = false,

XIndent = 100,

YIndent = 100,

Height = 55,

Width = 195

};



_doc.Pages[1].AddStamp(imageStamp);



this will die on the last line.



I’m totally clueless here - as it seems as if it works when it is done through a console application?!

Hi Henrik,


Thanks for contacting support.

The problem appears to be related to input image file which you are using, so can you please share the resource file, so that we can test the scenario in our environment. We are sorry for this inconvenience.