// Look up all services
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);

// Look up the default print service
PrintService service = PrintServiceLookup.lookupDefaultPrintService();

// Find all services that can support a particular
// input format; in this case, a GIF
services = PrintServiceLookup.lookupPrintServices(
    DocFlavor.INPUT_STREAM.GIF, null);

// Find a particular service by name;
// in this case "HP LaserJet 6MP PS"
AttributeSet aset = new HashAttributeSet();
aset.add(new PrinterName("HP LaserJet 6MP PS", null));
services = PrintServiceLookup.lookupPrintServices(null, aset);

// Find all services that support a set of print job capabilities;
// in this case, color
aset = new HashAttributeSet();
services = PrintServiceLookup.lookupPrintServices(null, aset);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.