When dialog boxes are used to print, the Page
Setup dialog box sets the margins, but it does not provide as much flexibility
as you have through view printer methods. You can set margin properties as described
in this topic whenever you use the ViewPrinter.print(boolean)
method
or the ViewPrinter.renderPage
method to perform printing.
The following properties of the ViewPrinter
control the size of margins:
TopMargin
BottomMargin
LeftMargin
RightMargin
All margins are 72 pixels by default.
The ViewPrinter
does not impose limits on the margin that you set. However, keep
the following guidelines in mind when setting margins:
Very large margins reduce the space available on a page for the view that you want to print.
Most print drivers have a mandatory margin of 18 pixels. You should set your margins large enough to account for these 18 pixels and for any headers and footers that you specify. Headers and footers appear in the margins.
Note: When you use
the printPage
method, the Graphics
to which the
view is printed does not include margins. If, when you use printPage
,
you set printScaleType
to a value other than ORIGINAL_SIZE
,
you should set the margins to 0 before you call startPrint
.