Using the renderPage Method to Print Part of a View

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:

How to use the renderPage method

When 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:

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.

Methods for changing the physical page to print

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

prepareFirstPage

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.

hasNextPage

Indicates whether the view has a physical page after the physical page that is currently being printed. Call prepareNextPage only if hasNextPage returns true.

prepareNextPage

Prepares the next physical page for printing and makes it the current page to print.

hasPrevPage

Indicates whether the view has a physical page before the physical page that is currently being printed. Call preparePrevPage only if hasPrevPage returns true.

preparePrevPage

Prepares the previous physical page for printing and makes it the current page to print.

isFirstPhysicalPage

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.

isLastPhysicalPage

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.

getSequentialPageNumber, setSequentialPageNumber

Indicates and specifies physical page numbers. When you print the logical page of one view, then the logical page of another view, call getSequentialPageNumber from the first view printer and pass its return value to setSequentialPageNumber for the second view printer. This allows sequential page numbering between the two different view printers.

The following example uses the renderPage method to print.

Example: Printing the Same Logical Page of Two Different Views