Interface PrintService
- All Known Subinterfaces:
MultiDocPrintService
- All Known Implementing Classes:
StreamPrintService
public interface PrintService
Interface
PrintService
is the factory for a DocPrintJob
. A
PrintService
describes the capabilities of a printer and can be
queried regarding a printer's supported attributes.
Example:
DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(flavor, aset);
if (pservices.length > 0) {
DocPrintJob pj = pservices[0].createPrintJob();
try {
FileInputStream fis = new FileInputStream("test.ps");
Doc doc = new SimpleDoc(fis, flavor, null);
pj.print(doc, aset);
} catch (FileNotFoundException fe) {
} catch (PrintException e) {
}
}
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers a listener for events on thisPrintService
.Creates and returns aPrintJob
capable of handling data from any of the supported document flavors.boolean