I can not get the PrinterState of my printers. I tested the following code on Linux and Windows (7) with different printers (Samsung, Brother (Linux only), Zebra, ...). But in each case, the PrinterState and PrinterStateReasons objects are null.
private void dumpPrinterState() { PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); //get printers for (PrintService printService : printServices) { log.info("---- printer: " + printService); log.info("---- state: " + printService.getAttribute(PrinterState.class)); log.info("---- reason: " + printService.getAttribute(PrinterStateReasons.class)); } }
Here is the result with my attempt on Windows:
---- printer: Win32 Printer : ZDesigner KR403 ---- state: null ---- reason: null ---- printer: Win32 Printer : Samsung CLP-300 Series ---- state: null ---- reason: null ---- printer: Win32 Printer : Microsoft XPS Document Writer ---- state: null ---- reason: null ---- printer: Win32 Printer : Fax ---- state: null ---- reason: null
Does anyone know what is wrong?
source share