Java Language Java Print Service Discovering the available print services


To discovery all the available print services, we can use the PrintServiceLookup class. Let's see how:

import javax.print.PrintService;
import javax.print.PrintServiceLookup;

public class DiscoveringAvailablePrintServices {

    public static void main(String[] args) {

    public static void discoverPrintServices() {
        PrintService[] allPrintServices = PrintServiceLookup.lookupPrintServices(null, null);
        for (Printservice printService : allPrintServices) {
            System.out.println("Print service name: " + printService.getName());


This program, when executed on a Windows environment, will print something like this:

Print service name: Fax
Print service name: Microsoft Print to PDF
Print service name: Microsoft XPS Document Viewer