CONTENTS | PREV | NEXT

Obtaining a Print Job

A print job is a submitted print request and includes one or more pieces of print data and a set of processing instructions. The Java Print Service represents a print job with the DocPrintJob object. Whether you are sending print data to a stream or to a printer, you create a print job in the same way: by calling createPrintJob on the service:

   DocPrintJob pj = pservices[0].createPrintJob();
An application obtains a print job from a service because the service only creates print jobs that are capable of handling data that the particular service can accept.

The DocPrintJob interface provides the print method, which takes a PrintRequestAttributeSet parameter and a Doc encapsulating the print data and the doc flavor:

   pj.print(doc, aset);
The next section discusses creating a Doc.

CONTENTS | PREV | NEXT

Oracle and/or its affiliates
Java Technology

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

Contact Us