Creating a print job from a print service
suggest changeA print job is a request to print something on a specific print service. It consists of:
- the data that will be printed (see Building the Doc that will be printed)
- a set of attributes
After choosing a print service, request a print job from it:
DocPrintJob printJob = printService.createPrintJob();
The DocPrintJob interface provides the print method:
printJob.print(doc, pras);
The doc argument is a Doc: the data that will be printed.
The pras argument is a PrintRequestAttributeSet: a set of PrintRequestAttribute values. Examples include:
- number of copies (1, 2, and so on)
- orientation (portrait or landscape)
- chromaticity (monochrome, color)
- quality (draft, normal, high)
- sides (one-sided, two-sided, and so on)
The print method may throw a PrintException.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents