List of usage examples for javax.print.attribute DocAttributeSet add
public boolean add(Attribute attribute);
From source file:org.springframework.integration.print.outbound.PrintMessageHandler.java
@Override protected void handleMessageInternal(Message<?> message) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("Printing using printer '" + this.printServiceExecutor.getPrintService().getName() + "'."); }/* ww w .j a v a2 s. c om*/ DocAttributeSet das = new HashDocAttributeSet(); das.add(Chromaticity.MONOCHROME); Object payload = message.getPayload(); final Doc doc = new SimpleDoc(message.getPayload(), docFlavor, das); final DocPrintJob job = this.printServiceExecutor.getPrintService().createPrintJob(); PrintJobMonitor printJobMonitor = new PrintJobMonitor(job); job.print(doc, this.printRequestAttributeSet); printJobMonitor.waitForDone(); if (payload instanceof InputStream) { ((InputStream) payload).close(); } }