Printing in Java
The original JDK 1.0 release did not provide any printing support. The release of the 1.1 version of the Java Developer's Kit in 1997 provided Java developers with a basic framework for printing from applications. Java provides classes for printing on printer through Java 2D printing API. The Java 2D printing API is not limited to printing graphics. It enables user to print the content of an application's user interface as well. The main classes and interfaces involved in printing are represented in the java dot a-w-t dot print and java-x dot print packages.
The basic printing operations performed by Java Printing API are Creating print job and Readying printer for print job. To print, a client initiates a print job by obtaining a new instance of Print Job. The print job is a unit of work to be run on printer, decided by the application using printing API. Every print job is assigned a job number when received and severed according to the job number. Deciding the print job once, application can send strips of page instead of the whole page to the printer. The application only needs to know how to render the print job. There are two printing models in Java: Printable jobs and Pageable jobs.