Generic GDI+ Exception Followed by OutOfMemory Exception
I'm working on a VB.Net WinForms app. This app shows rows of production lines that the user will go down row by row and print a package of ActiveReports documents. This package can contain up to 9 reports. The package is selected and told to print, it then gets sent directly to the default printer of the machine using ActiveReports' mechanism:
rpt.Document.Print(False, False, True)
These reports also use images pulled in from the file system. When they run through the rows quickly, they sometimes encounter:
A generic error ocurred in GDI+
Then followed by:
Exception of type "System.OutOfMemoryException" was thrown.
This causes some documents to not print and they have to go back and figure out which ones didn't print. I know the machine is not out of memory, so my assumption is that the printer memory is filling up or reports are trying to use the same image when printing and causing an issue there.
If it is the printer memory filling up, is there any way to slow down the adding of开发者_JAVA技巧 documents to the print queue, or at least pausing to wait for space? I'm kind of at a loss and would appreciate any suggestions.
Thanks.
I decided to just use the caching capability built into ActiveReports. That seemed to alleviate some of the problems with the printer. I also added some slowing down of the thread in order to make sure the memory clears out before adding more documents to the print queue. Thanks.
精彩评论