Setting Page Margins When You Print a View

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.

Setting page margins

The following properties of the ViewPrinter control the size of margins:

All margins are 72 pixels by default.

Guidelines for setting margins

The ViewPrinter does not impose limits on the margin that you set. However, keep the following guidelines in mind when setting 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.