0

I have implemented a printing system in java. I need to get printer status, So I used AttributeSet in this way:

PrintService service = PrintServiceLookup.lookupDefaultPrintService();
AttributeSet attributeSet = service.getAttributes();
for (Attribute a : attributeSet.toArray()) {
     System.out.println(a.getName() + ": " + attributeSet.get(a.getClass()).toString());
}

This returns me below output(even if the printer is off or pause):

printer-name: EPSON LQ-350 ESC/P2
color-supported: not-supported
printer-is-accepting-jobs: accepting-jobs
queued-job-count: 0

But, I need to printer status more specific, for example I need to know whether the printer is off or pause, or whether paper is ok or not. How can I get exact printer status?

hamed
  • 7,939
  • 15
  • 60
  • 114
  • is PrintService implementation based on CUPS ref: https://en.wikipedia.org/wiki/CUPS ? – Balaji Krishnan Feb 02 '16 at 07:22
  • Remember that this is an interface for a print _service_, not a physical printer. The attributes available will depend completely on the operating system and driver implementation. You are at the mercy of the specific driver for the printer for hardware-specific status information. – Jim Garrison Feb 02 '16 at 07:28
  • @JimGarrison Could you explain me further? – hamed Feb 02 '16 at 13:07
  • @hamed he means that depending on the OS and the delivered driver from the printer you are limited in options. If the printer supports the delivering of this status information then you are able to achive this. But if it doesn´t then you are not. Basicly the answer to you question is, depending on the printers driver and the os this is not possible. – SomeJavaGuy Feb 02 '16 at 13:19

0 Answers0