JViews Framework
provides a document class, IlvManagerPrintableDocument, which is a
subclass of the generic
IlvPrintableDocument
class. The
IlvManagerPrintableDocument
class is dedicated to printing the contents of a manager on
multiple pages.
When using the
IlvManagerPrintableDocument
class, you do not have to create pages and add them to the
document. This class will create the pages for you, depending on
the parameters you specify for the document.
In addition to the generic parameters defined in the superclass IlvPrintableDocument such as the name and
author of the document, the page format, the header and footer, and
the page order, the
IlvManagerPrintableDocument
class allows you to specify the following options:
- The number of pages
- The area of the manager to be printed
- The zoom level used for printing
The following code creates an instance of
IlvManagerPrintableDocument
to print the area (0,0,500,500) of a manager in five columns:
IlvManagerPrintableDocument document = new IlvPrintableManagerDocument ("My Document", view); document.setColumnCount(5); document.setPrintArea(new IlvRect(0,0,500,500));
Number of pages
The number of pages is determined by the
number of rows and columns that you specify as follows:
- If you specify the number of rows, the document computes the number of columns necessary to cover the area to print.
- If you specify both the number of rows and the number of columns, then the document class will choose to use the number of rows or the number of columns to produce the minimum number of pages.
To print the manager on one page, set the
number of rows and the number of columns to 1.
Area to print
The area of the manager to print is specified by the
setPrintArea
and
getPrintArea
methods. When no print area has been specified, then the printed
area will be the full area of the manager. To reset the area to
print to the full area of the manager, call:
document.setPrintArea(null);
Zoom Level for Printing
The contents of the manager may be
graphically different when a different zoom level is used, in
particular when the manager contains nonzoomable objects. Thus,
when printing the manager, you may need to specify the zoom level
used for printing. By default, the contents of the manager are
printed using the identity affine transform (that is, zoom level
1).