You need to use renderPage
if you want to print the view and something else on
a single page, or if you want control over the order in which a view is printed. For example,
you need responsibility for the print job if you want to do any of the following tasks:
Print two views on the same piece of paper
Print another object with a view, on one or more pieces of paper
Print a logical page of one view, then a logical page of another view, then the next logical
page of the first view, and so on (as opposed to printing all logical pages of one view and
then all logical pages of another view -- for that you can call the print
method,
passing false
as the parameter.)
renderPage
methodWhen you use renderPage
, you assume responsibility for more of the print job or
printer job than you do when you use the print
method. You are responsible for the
following tasks:
Creating and managing the print job
Specifying the size of the area in which the view should be printed.
You specify a Dimension
object into which the view will be printed. Include
room for margins, because the margin properties are respected when the view is printed. Headers
and footers appear in the margins.
Providing a Graphics
object into which the view is printed
Specifying the physical page to print.
The view printer keeps track of the number of physical pages in a logical page, but you must call methods to change the physical page to print. The view printer provides methods for changing the physical page.
When you use renderPage
, all of the properties that you can set on the view
printer are effective, as they are when you use the print
method. For a list of
those properties, see Using the
print
Method of a ViewPrinter.
The following table lists the methods, with their descriptions, that are provided
by view printers for changing pages when you use the renderPage
method.
Method |
Description |
---|---|
|
Prepares the first page for printing, and makes it the current page to print. This method also initializes member variables of the view printer, so you must call this method before you call any other methods in this table. |
|
Indicates whether the view has a physical page after the physical page that is currently
being printed. Call |
|
Prepares the next physical page for printing and makes it the current page to print. |
|
Indicates whether the view has a physical page before the physical page that is currently
being printed. Call |
|
Prepares the previous physical page for printing and makes it the current page to print. |
|
Indicates whether the current physical page is the first physical page in the current logical page. For more information about the relationship between physical and logical pages, see Printing Logical Pages of Crosstabs and Tables. |
|
Indicates whether the current physical page is the last physical page in the current logical page. This method is especially useful when you want to print a logical page of one view and then a logical page of a different view. |
|
Indicates and specifies physical page numbers. When you print the logical
page of one view, then the logical page of another view, call |
The following example uses the renderPage
method to print.
Example: Printing the Same Logical Page of Two Different Views