printing page break

D

Dave Cullen

VB Dotnet printing is such a chore.

My print code is copied from MSDN and uses PrintDocument, with a PrintPage
handler. I need to force a page break at specific points in my document and
can't figure out how to do that. I've been fussing around with different
fonts and margin settings and blank lines on the page and whatever else I
can think of to format a specific page in memory so that VB prints it like I
want, but it all changes if I use another printer.

I just need to insert a page break somehow. In the old days I'd just send
CHR12 to the printer but that doesn't work any more with this
Graphics.DrawString nonsense. If I format each page separately and print
them one at a time it fills the print queue up with multiple documents...
not very elegant.

Someone give me a hand here please. How do I tell PrintDocument to spit the
paper out at a specific point and start the remaining print text as the next
page?

Thanks.
 
H

Herfried K. Wagner [MVP]

Dave Cullen said:
VB Dotnet printing is such a chore.

My print code is copied from MSDN and uses PrintDocument, with a PrintPage
handler. I need to force a page break at specific points in my document
and can't figure out how to do that.

Set 'e.HasMorePages' to 'True' in the 'PrintPage' event handler and exit the
event handling routine. This will cause a page break and the handler will
be called again in order to print the second (or consecutive) page.
 

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