You use the print method of a view printer when you want the bean to manage the print job, but you provide your own user interface.This is appropriate under the following circumstances:
You want to allow your users to print one or all logical pages of a view at a time.
When the bean manages printing, it prints one view at a time. You can use the same printer
job for more than one view, but you cannot, for example, print the first logical page of a
crosstab, then the first logical page of a graph, then the second logical page of the crosstab,
then the second logical page of a graph, and so on. (To do this kind of printing, see
Using the renderPage
Method
to Print Part of a View.)
Your users do not need to print a range of rows and columns.
The default user interface can print a single logical page, a range of pages, or all pages.
The default user interface does not support printing that starts with something other than the
first row and column of the table or crosstab. (To do this kind of printing, see
Using the printPage
Method to Take Control of a Print Job.)
print
method of a view printerTo call the print method of a view printer, you create an appropriate view printer (for
example, a CrosstabPrinter
to print a crosstab). You create a print job, either
by calling the showPrintJob
method of the view printer, or by constructing a print
job and then calling the setPrintJob
method of the view printer to set the print
job. To provide input from your user interface, you set properties on the view printer. Then you
call print
, to print the view. The print
method must come between a
startPrint
and an endPrint
method.
To provide input from your user interface, you set properties on the view printer before you
call startPrint
.
The following table lists properties, with their descriptions. You can set these properties on the view printer to affect the way that it prints the view.
Property |
Description |
---|---|
|
When |
|
Specifies whether gridlines should be visible. |
|
Specifies a callback that you can write, when you want to display different header or footer information on different printed pages of the view. For more information about this callback, see Printing Different Headers and Footers on Different Pages. |
|
Specifies which headers and footers use a custom callback. |
|
Sets the margins of the page on which the will be printed. The default for all margins is 72 pixels, or one inch. |
|
Specifies the margins between the header and footer and the edge of the page. See Specifying Headers and Footers in Printed Views. |
|
Specifies the behavior of the margins when a header or footer does not fit in the margin. See Specifying the Interaction of Headers, Footers, and Margins in Printed Views. |
|
Specifies the |
|
In a table or crosstab that does not fit on one physical page, specifies whether the second physical page shows the columns to the right of the first page, or the rows below the first page. For more information, see Printing Logical Pages of Crosstabs and Tables. |
|
Sets how to size the view for printing. By default, the view is printed at its original size. |
|
When |
|
Specifies whether to print the current logical page or a range of logical pages using the
|
|
In a table or crosstab that does not fit on one physical page, specifies whether the row and column headers appear on each page or only on pages that print the first row or column. Also affects the title, subtitle, footnote, and paging control, if they are visible. |
|
In a graph, when |
|
When |
|
Specifies a handler for token substitution, which makes it possible for you to insert tokens (such as a token for the current dimension member) in the headers and footers of the view printer. |
The following example shows how to use the print method: