Convert PDF to PNG in C# using Aspose.PDF - A generic error occurred in GDI+

Following error message is received when trying to convert pdf to png.

<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>A generic error
occurred in GDI+.



SOURCE: /Pdf/GetPdfImage.aspx?DocumentId=205937&PageNumber=0



QUERYSTRING: DocumentId=205937&PageNumber=0



TARGETSITE: Void Save(System.IO.Stream, System.Drawing.Imaging.ImageCodecInfo,
System.Drawing.Imaging.EncoderParameters)



STACKTRACE: at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder,
EncoderParameters encoderParams) at .B.(Stream , B ) at
Aspose.Pdf.Devices.PngDevice.Process(Page page, Stream output) at
FTPProcess.PDFConverter.ConvertPdfToPngList(Byte[] bytes, Int32 PageNumber) at
CaseManagement.Document.GetPngSrcFromPdf(Document doc, Int32 PageNumber) at
PDF_Default.Page_Load(Object sender, EventArgs e) at
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object
t, EventArgs e) at System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)



<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi Dinar,


Thanks for your inquiry. Could you please share your source Pdf document here? So we will test it at our end and will provide you more information accordingly.

Sorry for the inconvenience faced.

Best Regards,

its a normal PDF. This is solved after we restart the app pool. i am not sure what was the problem. System was running fine for 30 days fine, then suddenly this error started happening. after the app pool reset last night it starting working again.

can you tell me why its started suddenly.

Hi Dinar,


Thanks for your feedback. Its good to know that your issue has been fixed. I’m afraid we don’t have any such known issue so we can’t suggest you anything without replicating and investigating the issue at our side. If it happens again then please check whether every Pdf document creating issue or some specific one.

Please feel free to contact us for any further assistance.

Best Regards,

A post was split to a new topic: When converting PDF pages to PNG an error occurred