Error: A generic error occurred in GDI+.

Stimulsoft Reports.NET discussion
Tomer
Posts: 5
Joined: Wed Mar 04, 2009 3:23 am

Error: A generic error occurred in GDI+.

Post by Tomer »

Hello,
When I try to preview of print a big report under windows 7 or windows 2008 I get the following error (after Report.Load(reportname));
Exception.Message:
A generic error occurred in GDI+.

There is no problem with windows 2003 or windows XP.
=============================

Exception.StackTrace:
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(MemoryStream stream)
at System.Drawing.ImageConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType)
at System.ComponentModel.TypeConverter.ConvertTo(Object value, Type destinationType)
at Stimulsoft.Base.Drawing.StiImageConverter.ImageToBytes(Image image)
at Stimulsoft.Base.Drawing.StiImageConverter.ImageToString(Image image)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.AddImage(String parent, String name, StiPropertyInfo prop)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.SerializeProps(StiPropertyInfoCollection props, Boolean isList, String parentName, String referenceName)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.SerializeProps(StiPropertyInfoCollection props, Boolean isList, String parentName, String referenceName)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.SerializeProps(StiPropertyInfoCollection props, Boolean isList, String parentName, String referenceName)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.SerializeProps(StiPropertyInfoCollection props, Boolean isList, String parentName, String referenceName)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.SerializeProps(StiPropertyInfoCollection props, Boolean isList, String parentName, String referenceName)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.SerializeProps(StiPropertyInfoCollection props, Boolean isList, String parentName, String referenceName)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.SerializeProps(StiPropertyInfoCollection props, Boolean isList, String parentName, String referenceName)
at Stimulsoft.Report.CodeDom.StiCodeDomSerializator.Serialize(StiReport report, String name, StiLanguage language, Boolean serializeData, Boolean saveForInheritedReports, Object standaloneReportType)
at Stimulsoft.Report.StiReport.ScriptUnpack(Boolean saveForInheritedReports)
at Stimulsoft.Report.StiReport.ScriptUnpack()
at Stimulsoft.Report.SaveLoad.StiXmlReportSLService.Load(StiReport report, Stream stream)
at Stimulsoft.Report.StiReport.Load(StiReportSLService service, Stream stream)
at Stimulsoft.Report.StiReport.Load(Stream stream)
at Stimulsoft.Report.StiReport.Load(String path)
at StimulReport2010_01.StimulReport.GetCompiledVersion(String reportDllName, String reportFileName, StiReport& report, String& errmessage) in E:\Source\2005\Unifreight\StimulReport\StimulReport2010_01\StimulReport.cs:line 698



Thanks.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Error: A generic error occurred in GDI+.

Post by Ivan »

Hello,

If we diagnose the issue in the correct way, the problem is already fixed.
Please check the latest prerelease build.

Thank you.
Tomer
Posts: 5
Joined: Wed Mar 04, 2009 3:23 am

Error: A generic error occurred in GDI+.

Post by Tomer »

Thanks !!!
The problem has been fixed with new version 2011.1
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Error: A generic error occurred in GDI+.

Post by Andrew »

Hello,

Thank you for letting us know about this!
LukasT
Posts: 304
Joined: Mon May 03, 2010 2:50 am
Location: Czech Republic

Re: Error: A generic error occurred in GDI+.

Post by LukasT »

Hello,
the same problem still exists on another place:

System.ApplicationException: A generic error occurred in GDI+. --->
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Bitmap.GetHbitmap(Color background)
at System.Drawing.Bitmap.GetHbitmap()
at Stimulsoft.Report.Wpf.StiImageHelper.GetImageSource(Image image)
at Stimulsoft.Report.Painters.StiViewWpfPainter.PaintImage(StiView
view, DrawingContext dc, Rect rect)
at Stimulsoft.Report.Painters.StiViewWpfPainter.Paint(StiComponent
component, StiPaintEventArgs e)
at
Stimulsoft.Report.Painters.StiImageWpfPainter.Paint(StiComponent
component, StiPaintEventArgs e)
at Stimulsoft.Report.Components.StiComponent.Paint(StiPaintEventArgs e)
at
Stimulsoft.Report.Painters.StiContainerWpfPainter.PaintComponents(StiContainer
container, StiPaintEventArgs e)
at Stimulsoft.Report.Painters.StiPageWpfPainter.Paint(StiComponent
comp, StiPaintEventArgs e)
at Stimulsoft.Report.Components.StiComponent.Paint(StiPaintEventArgs e)
at
Stimulsoft.Report.Viewer.StiWpfViewerControl.CreatePageVisual(StiPage
page)
at
Stimulsoft.Report.Viewer.StiWpfViewerControl.RefreshPageVisual(StiPageVisual
pageVisual, StiPage page)
at
Stimulsoft.Report.Viewer.StiWpfViewerControl.RenderPageContent(StiPageVisual
pageVisual)
at
Stimulsoft.Report.Viewer.StiWpfViewerControl.UpdatePagesPlacement(Boolean
allowAnimation, Double baseOpacity)
at Stimulsoft.Report.Viewer.StiWpfViewerControl.AssignNewReport()
at
Stimulsoft.Report.Viewer.StiWpfViewerControl.SetNewReport(StiReport
oldReport, StiReport value)
at
Stimulsoft.Report.Viewer.StiWpfViewerControl.OnReportChanged(Object
sender, DependencyPropertyChangedEventArgs e)
....
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: Error: A generic error occurred in GDI+.

Post by Jan »

Hello Lukas,

Typically this problem occurs when something wrong with the image. In some cases GDI can't correctly load some parts of image and it can generate this error in some drawing mode.
Please try to re-save image. Some times it helps. Also please send to use mdc file for this report. Usually mdc file helps to easy detect similar problems with painting.

Thank you.
VaDRo
Posts: 25
Joined: Mon Dec 15, 2014 5:47 pm

Re: Error: A generic error occurred in GDI+.

Post by VaDRo »

Hi!

I'm using Stimulsoft.Net 2011.1.1000 and I have the same problem. I'm trying to produce report with client signatures. One page with one signature. After rendering, this report should be saved in PDF or Excel format. When amount of pages exceeds some value (approx. 800-900) my app crashes with exception:

for PDF format -
Application Error
An error occurred please contact the adminstrator with the following information:
A generic error occurred in GDI+.
Stack Trace:
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height)
at System.Drawing.Graphics.FillRectangle(Brush brush, Rectangle rect)
at Stimulsoft.Report.Viewer.StiPageViewControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
for Excel format -
System.OutOfMemoryException
This exceptions was produced for the same data.

In order to test this problem, I updated all signatures in test DB to the same value. When my app generates report with 300-400 pages with the same signature, everything is OK. But when I'm trying to build report with 1000 pages, it crashes. So, it couln't be problem with image.
Please, give me any advise about this problem.
VaDRo
Posts: 25
Joined: Mon Dec 15, 2014 5:47 pm

Re: Error: A generic error occurred in GDI+.

Post by VaDRo »

Some addtitional info about my report:
- signatures stored in DB in Base64 format
- to display signature, I'm using Image control in data band.
- for Image control specified this formule:

Code: Select all

{StiImageHelper.GetImageFromObject(System.Convert.FromBase64String(sq_TicketSingle.Signature))}
- data band is freeform (not grid)
- for each row I'm using new page of report

Report is building from C# project. Some code:

Code: Select all

...
            StiReport reportCtrl = new StiReport();
            
            reportCtrl.Load(_ReportTemplate);

            //Set Database connection params
            reportCtrl.Dictionary.Databases.Clear();
            reportCtrl.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", (ConfigurationManager.AppSettings["connectionString"]).Replace("Provider=SQLOLEDB;", string.Empty)));

            //Set values for  report variables
            BindReportVariables(reportCtrl, reportParms);

            foreach (StiSqlSource s in reportCtrl.Dictionary.DataSources)
                if (s.CommandTimeout <= 30)
                    s.CommandTimeout = 300;

            reportCtrl.Render();

            if (!String.IsNullOrEmpty(SaveAs))
            {
                    switch (SaveAsFormat)
                    {
                        case FileFormats.FORMATS.HTML:
                            reportCtrl.ExportDocument(StiExportFormat.Html, SaveAs);
                            break;
                        case FileFormats.FORMATS.TEXT:
                            reportCtrl.ExportDocument(StiExportFormat.Text, SaveAs);
                            break;
                        case FileFormats.FORMATS.PDF:
                            reportCtrl.ExportDocument(StiExportFormat.Pdf, SaveAs);
                            break;
                        case FileFormats.FORMATS.WORD:
                            reportCtrl.ExportDocument(StiExportFormat.Word2007, SaveAs);
                            break;
                        case FileFormats.FORMATS.EXCEL:
                            reportCtrl.ExportDocument(StiExportFormat.Excel, SaveAs);
                            break;
                        default:
                            throw new Exception("File Format not supported");
                    }
            }

            if (!isSilent)
                reportCtrl.Show();
Specified exception for PDF format is shown when user typed path to save report (SaveAs)

PS: sorry for my bad english
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Error: A generic error occurred in GDI+.

Post by HighAley »

Hello.

You have different error.
Please, try to upgrade to the latest build.
If the error still occurs, please, send us a sample report template with data.

Thank you.
VaDRo
Posts: 25
Joined: Mon Dec 15, 2014 5:47 pm

Re: Error: A generic error occurred in GDI+.

Post by VaDRo »

Aleksey Andreyanov wrote:Hello.

You have different error.
Please, try to upgrade to the latest build.
If the error still occurs, please, send us a sample report template with data.

Thank you.
Yes, I see that errors are different. But they are for different file formats, as You see.

How can I uprade my Stimulsoft version? I've got licensed version of software as distibutive, that was download from your server 2-3 years ago. As my colleagues mentioned to me, they had login/password for that server with updates, but that password is expired.
Post Reply