0

How to get the Printer description from a PrintService?

for (PrintService p : PrintServiceLookup.lookupPrintServices(null, null)) {
    System.out.println(printService.getAttribute(PrinterName.class));
    // System.out.println(printService.getAttribute(PrinterName.class));
}

The 9 year old question Extended printer information in Java has no answer yet. Only the PrinterName Attribute seems working.

Is there any way to get the printer description?

ceng
  • 128
  • 3
  • 17
fr_act
  • 1
  • 1

1 Answers1

0

The solution for java is https://github.com/harwey/cups4j

      CupsClient cupsClient = new CupsClient("127.0.0.1", 631);
         for (CupsPrinter cp : cupsClient.getPrinters()) {
            System.out.println("name" + " " + printer.getName());
            System.out.println("description" + " " + printer.getDescription());
            System.out.println("location" + " " + printer.getLocation());
            System.out.println("url" + " " + printer.getPrinterURL().toExternalForm());
            System.out.println("selected" + " " + printer.isDefault());
         }
      }
fr_act
  • 1
  • 1