Posted 17 October 2019, 4:46 pm EST
Recently we have intermittent errors when printing images in AR.The exception is
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at GrapeCity.ActiveReports.Controls.Image.#Yzd()
at GrapeCity.ActiveReports.SectionReportModel.Picture.#7UC(Image image1, Image image2)
at GrapeCity.ActiveReports.SectionReportModel.Picture.QuickSave(BinaryWriter binWriter)
at GrapeCity.ActiveReports.SectionReportModel.Section.#jBb(Stream stream)
at GrapeCity.ActiveReports.SectionReportModel.Section.#gBb()
at #sxA.#vqb.#FEb(Boolean bTemp, #pqb pItem, #rqb pRegion)
at #sxA.#mqb.#SDb(Section section, Int32 insPos)
at #sxA.#vqb.#DEb(Boolean bAllowGrowth)
at #sxA.#vqb.#vEb()
at #sxA.#vqb.#bZA(Page newPage, Single left, Single top, Single right, Single bottom, UInt32 flags, UInt32& status)
at GrapeCity.ActiveReports.SectionReport.#4yb()
at GrapeCity.ActiveReports.SectionReport.Run(Boolean syncDocument)
at PopularERP.Report.InvoicePrintBase.ProcessPages(InvoicePageBase originalPageReport, String originalPageTitle, String originalWatermark, InvoicePageBase accountsCopyPageReport, String accountsCopyPageTitle, String accountsCopyWatermark, InvoicePageBase DNPageReport, String DNPageTitle, String DNWatermark, Boolean skipAccountsCopy, Boolean skipDN)
at PopularERP.Report.Sales.INVO_Print.INVO_Print_ReportStart(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at GrapeCity.ActiveReports.SectionReport.#hzb()
at GrapeCity.ActiveReports.SectionReport.#1yb(Boolean bDelayedInit)
at GrapeCity.ActiveReports.SectionReport.Run(Boolean syncDocument)
The code that I believe causing the error
Picture logoPic = new Picture();
logoPic.Image = Image.FromStream(memoryStream);
logoPic.Width = SectionReport.CmToInch(18);
logoPic.Height = SectionReport.CmToInch(2.94F);
logoPic.PictureAlignment = PictureAlignment.TopLeft;
logoPic.SizeMode = SizeModes.Clip;
pageHeader.Controls.Add(logoPic);
The exception is thrown recently in production server from time to time. We cannot repeat it in development server. We have no changes in code recently. Please help.