List of usage examples for javax.print PrintServiceLookup lookupDefaultPrintService
public static final PrintService lookupDefaultPrintService()
From source file:org.springframework.integration.print.core.PrintServiceExecutor.java
public PrintServiceExecutor(String printerName) { if (!StringUtils.hasText(printerName)) { this.printService = PrintServiceLookup.lookupDefaultPrintService(); Assert.notNull(this.printService, "Did not find a the default print service."); } else {//from w w w .j a va 2s .c o m PrintService matchingPrintService = null; for (PrintService printService : PrintServiceExecutor.getAvailablePrinterServices()) { if (printerName.equalsIgnoreCase(printService.getName())) { matchingPrintService = printService; break; } } this.printService = matchingPrintService; Assert.notNull(this.printService, String.format("Did not find the" + "print service for printer '%s'.", printerName)); } if (logger.isInfoEnabled()) { logger.info("Setting up print service for printer '" + this.printService.getName() + "'."); } else if (logger.isDebugEnabled()) { logger.debug(this.getPrinterInfo()); } }