Previous | Next | Trail Map | 2D Graphics | Overview of the Java 2D API

Printing

All of the AWT and Java 2D graphics, including composited graphics and images, can be rendered to a printer using the Java 2D Printing API. The Java 2D Printing API also provides document composition features that enable you to perform operations such as changing the order in which pages are printed.

Rendering to a printer is like rendering to the screen--the printing system controls when pages are rendered, just like the drawing system controls when a component is painted on the screen.

Your application provides the printing system with information about the document to be printed and the printing system determines when each page needs to be imaged. When pages need to be imaged, the printing system calls your application's print method with an appropriate Graphics context. To use Java 2D API features when you print, you cast the Graphics object to a Graphics2D , just like you do when you're rendering to the screen.


Previous | Next | Trail Map | 2D Graphics | Overview of the Java 2D API