List of usage examples for javax.print.attribute HashPrintServiceAttributeSet HashPrintServiceAttributeSet
public HashPrintServiceAttributeSet(PrintServiceAttributeSet attributes)
From source file:org.openvpms.web.component.im.till.CashDrawer.java
/** * Opens the drawer.//from w w w . jav a 2 s . c o m * * @throws PrintException if the drawer cannot be opened */ public void open() throws PrintException { AttributeSet attrSet = new HashPrintServiceAttributeSet(new PrinterName(printer, null)); PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, attrSet); if (printServices.length == 0) { throw new PrintException(Messages.format("till.drawerCommand.printernotfound", printer)); } DocPrintJob job = printServices[0].createPrintJob(); DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE; Doc doc = new SimpleDoc(command, flavor, null); job.print(doc, null); }