1

How can I display all the printers installed on the device in Java?

So far to find my printer I use :

    PrintUtility.findPrintService(printer); //Selects any printer with the name provided
    PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, null);
    //System.out.println("Printers avialiable are " + services);
    System.out.println("Printer Selected " + services[Printerinx]);

But I wish to display in the console, all printers. How can I achieve this ?

Maroun
  • 94,125
  • 30
  • 188
  • 241
user2065929
  • 1,065
  • 4
  • 21
  • 35
  • 1
    Assuming the lookupPrintServices returns all printers, to display the array user Arrays.toString(services) – orangegoat Mar 07 '13 at 14:57

1 Answers1

2

Try

PrintServiceLookup.lookupPrintServices(null, null);

This returns PrintService[], filled with all printers the system has available.

Durandal
  • 19,919
  • 4
  • 36
  • 70