Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

PrintToPrinter() out of memory exception

$
0
0

I am using the CR for VS2010 for printing images.  The report is made up of two data elements: tiff images and index data.

 

Each report is on average 35 pages.  I spool on average 11 consecutive print jobs in one run.  With this high volume I will get an OutOfMemory exception from the PrintToPrinter() method.

 

I'm not sure if this is related to the print driver (lexmark t650), the CR objects, or something else.

 

When this error occurred I also trap for out of memory via the print queue object (code block below).

 

printQueue.IsOutOfMemory property is always false so I do not know how to determine where the error is really happening.

 

I saw another thread on SCN but I do not know if the RAS would be applicable to my environment.

 

catch (Exception LclExp)

            {

                Sys.LogMessage("TfrmPrinter.PrintBmp error: " + LclExp.Message, "Error", TraceEventType.Error);

 

                LocalPrintServer server = newLocalPrintServer();

                PrintQueueCollection queueCollection = server.GetPrintQueues();

                PrintQueue printQueue = null;

 

                foreach (PrintQueue pq in queueCollection)

                {

                    if (pq.FullName == "Lexmark T650 (DOF)")

                        printQueue = pq;

                }

 

                int numberOfJobs = 0;

                bool mem = false;

                if (printQueue != null)

                    numberOfJobs = printQueue.NumberOfJobs;

                mem = printQueue.IsOutOfMemory;

 

                Result = false;

            }

 

Exception:

 

"System.OutOfMemoryException: Out of memory.\r\n   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)\r\n   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)\r\n   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)\r\n   at CrystalDecisions.Shared.PageRender.draw_ImageInstance(ImageObjectInstance imageInst, Graphics g)\r\n   at CrystalDecisions.Shared.PageRender.draw_ReportObjectInstance(ReportObjectInstance instance, Graphics g, Rectangle clipRect)\r\n   at CrystalDecisions.Shared.PageRender.draw_SectionInstance(SectionInstance section, Graphics g, Rectangle clipRect)\r\n   at CrystalDecisions.Shared.PageRender.Render(PageObject page, Graphics g)\r\n   at CrystalDecisions.Shared.PrintingHelper.PrintPage(PrintP

ageEventArgs e, PageObject page, PrintLayoutSettings layoutSettings, Int32& currentPageNumber, Int32& currentHorizontalPageNumber)\r\n   at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintPageEventHandler(Object sender, PrintPageEventArgs e)\r\n   at System.Drawing.Printing.PrintDocument.OnPrintPage(PrintPageEventArgs e)\r\n   at System.Drawing.Printing.PrintDocument._OnPrintPage(PrintPageEventArgs e)\r\n   at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)\r\n   at System.Drawing.Printing.PrintController.Print(PrintDocument document)\r\n   at System.Drawing.Printing.PrintDocument.Print()\r\n   at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)\r\n   at CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)\r\n   at GOV.NYC.Finance.ACRIS.BackOffice.PrintServer.TfrmPrinter.PrintBmp(Int32 StartPage, Int32 EndPage,

Boolean Certify) in C:\\code_rewrite\\Development\\ACRIS Solution\\ACRIS.BackOffice\\PrintServer\\TfrmPrinter.cs:line 105"


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>