The system controls the overall printing process, just like it controls when and how a program can draw. Your application provides information about the document to be printed, and the printing system determines when each page needs to be rendered. 

This callback printing model enables printing to be supported on a wide range of printer and systems. It even allows users to print to a bitmap printer from a computer that doesn't have enough memory or disk space to hold the bitmap of an entire page. In this situation the printing system will ask your application to render the page repeatedly so that it can be printed as a series of smaller images. (These smaller images are typically referred to as bands, and this process is commonly called banded printing.) 

To support printing, an application needs to perform two tasks: 

Job Control

Although the system controls the overall printing process, your application has to get the ball rolling by setting up a PrinterJob. The PrinterJob , the key point of control for the printing process, stores the print job properties, controls the display of print dialogs, and is used to initiate printing. 

To steer the PrinterJob through the printing process, your application needs to 
The rendering of pages is controlled by the printing system through calls to the application's imaging code. 

Imaging

Your application must be able to render any page when the printing system requests it. This rendering code is contained in the print method of a page painter--a class that implements the Printable interface. You implement print to render page contents by using a Graphics or a Graphics2D rendering context. You can use either one page painter to render all of the pages in a print job or different page painters for different types of pages. When the printing system needs to render a page, it calls print on the appropriate page painter. 

When you use a single page painter, the print job is called a printable job. Using a printable job is the simplest way to support printing. More complex printing operations that use multiple page painters are referred to as pageable jobs. In a pageable job an instance of a class that implements the Pageable interface is used to manage the page painters. 

                                                                                               

Hosted by www.Geocities.ws

1