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.