CONTENTS | PREV | NEXT
CHAPTER 5
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:
- Print 2D graphics using
PrinterJob.
- Stream 2D graphics using
PrinterJob
- Print 2D graphics using
DocPrintJob and a service-formatted DocFlavor
- Stream 2D graphics using
DocPrintJob and a service-formatted DocFlavor
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.
CONTENTS | PREV | NEXT