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

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
 
K

Ken Tucker [MVP]

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
-------------------
 
H

Herfried K. Wagner [MVP]

* "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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top