Printing Multiple Pages
So far, the examples in this chapter have been focusing on printing a single page. This, however, is not the common case when it comes to printing. More often than not, an application generates printouts that consist of multiple pages. So how is this accomplished? The PrintPageEventArgs parameter that is sent to the PrintPage event handler contains a property called hasMorePages. This property contains a Boolean value indicating whether more pages need to be printed. Because only your code knows this, you need to set this property at the end of the PrintPage event handler. This value defaults to False, which explains why your examples have only printed one page so far.
So how do you know when there are more pages to print? ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access