Skip to Content
avatar image
Former Member

Generic gdi+ error when printing a chart

Hi all,

I am having an issue with the Chart features of CR. Since adding a chart to my report I keep getting these gdi+, system.drawing errors. It happens whenever I try to print the report OR if I make a chart using the group way and double click it.

I'm using what i believe is the latest version of Crystal Reports for Visual Studio 2012.

Any help will be greatly appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • May 25, 2015 at 02:27 PM

    Can you attach the report so I can test and check it?

    Don

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Ok this code worked for me I found it on a different scn thread that I have since lost but here is the code:

      private void CloseGracefully()
              {
                  var objRptDocViewer = (ReportDocument)this.crystalReportsViewer.ViewerCore.ReportSource;
                  foreach (CrystalDecisions.CrystalReports.Engine.Table table in objRptDocViewer.Database.Tables)
                  {
                      table.Dispose();
                  }
                  objRptDocViewer.Database.Dispose();
                  objRptDocViewer.Close();
                  objRptDocViewer.Dispose();
                  report.Close();
                  report.Dispose();
                  report = null;
                  if (this.crystalReportsViewer.ViewerCore.ParameterFieldInfo != null)
                    { 
                  this.crystalReportsViewer.ViewerCore.ParameterFieldInfo.Clear();
                  this.crystalReportsViewer.ViewerCore.Dispose();
                  this.crystalReportsViewer.Owner = null;
                  this.crystalReportsViewer = null;
                    }
              }
      
      

      crystalReportsViewer is the name I gave my wpf crystal reports viewer. And report is the .rpt file.

      So what I did was I found this code on the thread and created a method that gets called when the window that holds the WPF viewer is closed. It clears out everything and since then I have had no issues with the GDI Error. Hope it helps anyone else with this issue.