Printing and Streaming 2D Graphics

The Java 2D™ printing API is the java.awt.print package that is part of the Java™ 2 SE, version 1.2 and later. The Java 2D printing API provides for creating a PrinterJob, displaying a printer dialog to the user, and printing paginated graphics using the same java.awt.Graphics and java.awt.Graphics2D classes that are used to draw to the screen.

Many of the features that are new in the Java Print Service, such as printer discovery and specification of printing attributes, are also very important to users of the Java 2D printing API. To make these features available to users of Java 2D printing, the java.awt.print package has been updated for version 1.4 of the Java™ 2 SE to allow access to the Java™ Print Service from the Java 2D printing API.

Developers of Java 2D printing applications have four ways of using the Java Print Service with the Java 2D API:

The Using PrinterJob to Print or Stream Graphics section explains the first two methods. The Using Service-Formatted Data section explains the other two methods.


Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved.