printing multiple pages, is there a better way to do this?

  • Thread starter Thread starter ray well
  • Start date Start date
R

ray well

hi,

i need to print multiple pages on a printer. this is what i'm using now

Sub Print()
Dim PrintDoc As New PrintDocument
AddHandler PrintDoc.PrintPage, AddressOf Me.PrintText

Do While bPrintingNotDone
PrintDoc.Print()
Loop
End Sub

Sub PrintText(ByVal sender As System.Object, ByVal e As
PrintPageEventArgs)
'logic to parse the text and pages to print, setting bPrintingNotDone
to false terminates the print job
e.Graphics.DrawString(PrintString, Font, Brushes.Black, New
PointF(x,y))
End Sub

each page flashes a page-being-sent-to-the-printer message. i there a way to
format multiple pages for printing, and sending them to
print in one swoop, and getting only one such message?. i would actually
prefer not to get the page-being-sent-to-the-printer message at all. is
there a way to suppress it?

thanks, ray

please respond to the list
 
Hi,

If you set e.hasmorepages to true in the print document it will call
the procedure to true and it will reuse the page being sent to print
message.
Sub Print()
Dim PrintDoc As New PrintDocument
AddHandler PrintDoc.PrintPage, AddressOf Me.PrintText

PrintDoc.Print()
End Sub

Sub PrintText(ByVal sender As System.Object, ByVal e As
PrintPageEventArgs)
'logic to parse the text and pages to print, setting bPrintingNotDone
to false terminates the print job
e.Graphics.DrawString(PrintString, Font, Brushes.Black, New
PointF(x,y))
e.HasMorePages = Not bPrintingNotDone

Ken
-------------------
 
* "ray well said:
i need to print multiple pages on a printer. this is what i'm using now

Sub Print()
Dim PrintDoc As New PrintDocument
AddHandler PrintDoc.PrintPage, AddressOf Me.PrintText

Do While bPrintingNotDone
PrintDoc.Print()
Loop
End Sub

Sub PrintText(ByVal sender As System.Object, ByVal e As
PrintPageEventArgs)
'logic to parse the text and pages to print, setting bPrintingNotDone
to false terminates the print job
e.Graphics.DrawString(PrintString, Font, Brushes.Black, New
PointF(x,y))
End Sub

Why not create multiple pages as shown in this sample?

<http://www.mvps.org/dotnet/dotnet/samples/printing/downloads/PrintFramework.zip>
 
Back
Top