tags:

views:

473

answers:

2

Hi.

I'm searching a possibility to get a list of installed printers. I'm using JDK 1.6 with a Windows operating system. Does anyone know a solution?

Thank you in advance. Best regards Thomas

+3  A: 

I haven't used this myself, but maybe javax.print.PrintServiceLookup contains what you are looking for.

Ronald Blaschke
+7  A: 

Just wanted to add a little snippet:

import javax.print.*;

class Test {

    public static void main (String [] args)
    {
        PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
        System.out.println("Number of print services: " + printServices.length);

        for (PrintService printer : printServices)
            System.out.println("Printer: " + printer.getName()); 
    }
}
Pedro Henriques
Thank you. Exactly what I searched.
Zubi