S
Scott M
I'm printing a directory of about 500 multi-page tifs to a high speed
printer and the spooler process is killing me!!!
here is a little code.....
Public Function PrintImage(ByVal SourceFile As String) As Boolean
Try
ImageToPrint = FromFile(SourceFile)
PageNumber = 0
ImagePages = ImageToPrint.GetFrameCount(FrameDimension.Page())
Catch ex As Exception
General.WriteToEventLog(ex.ToString, "Print Class",
EventLogEntryType.Error)
End Try
Try
PDocument.DocumentName = SourceFile
PDocument.Print()
Catch ex As Exception
General.WriteToEventLog(ex.ToString, "Print Class",
EventLogEntryType.Error)
Return False
End Try
Return True
End Function
Then the event on the global variable PDocument is being raised for the
pages....
Private Sub PagePrintFunction(ByVal sender As Object, ByVal e As
PrintPageEventArgs) Handles PDocument.PrintPage
Try
ImageToPrint.SelectActiveFrame(FrameDimension.Page, PageNumber)
PageNumber = PageNumber + 1
e.Graphics.DrawImage(ImageToPrint, 0, 0,
(e.PageSettings.PaperSize.Width - 40), (e.PageSettings.PaperSize.Height -
50))
If PageNumber < ImagePages Then
e.HasMorePages = True
End If
Catch ex As Exception
General.WriteToEventLog(ex.ToString, "Print Class",
EventLogEntryType.Error)
End Try
End Sub
This is not only really slow with larger images but as stated in the title,
my print spooler process turns into a 2 Gig memory monster after only about
160 images!!!!!!!!! Does anyone have a better solution or can tweak the
code? I'm kinda at my wits end over this. I've tried creating and
disposing of the PDocument variable in my loop that prints each file and
still the process grows.
MANY Thanks
Scott
printer and the spooler process is killing me!!!
here is a little code.....
Public Function PrintImage(ByVal SourceFile As String) As Boolean
Try
ImageToPrint = FromFile(SourceFile)
PageNumber = 0
ImagePages = ImageToPrint.GetFrameCount(FrameDimension.Page())
Catch ex As Exception
General.WriteToEventLog(ex.ToString, "Print Class",
EventLogEntryType.Error)
End Try
Try
PDocument.DocumentName = SourceFile
PDocument.Print()
Catch ex As Exception
General.WriteToEventLog(ex.ToString, "Print Class",
EventLogEntryType.Error)
Return False
End Try
Return True
End Function
Then the event on the global variable PDocument is being raised for the
pages....
Private Sub PagePrintFunction(ByVal sender As Object, ByVal e As
PrintPageEventArgs) Handles PDocument.PrintPage
Try
ImageToPrint.SelectActiveFrame(FrameDimension.Page, PageNumber)
PageNumber = PageNumber + 1
e.Graphics.DrawImage(ImageToPrint, 0, 0,
(e.PageSettings.PaperSize.Width - 40), (e.PageSettings.PaperSize.Height -
50))
If PageNumber < ImagePages Then
e.HasMorePages = True
End If
Catch ex As Exception
General.WriteToEventLog(ex.ToString, "Print Class",
EventLogEntryType.Error)
End Try
End Sub
This is not only really slow with larger images but as stated in the title,
my print spooler process turns into a 2 Gig memory monster after only about
160 images!!!!!!!!! Does anyone have a better solution or can tweak the
code? I'm kinda at my wits end over this. I've tried creating and
disposing of the PDocument variable in my loop that prints each file and
still the process grows.
MANY Thanks
Scott