lookup All Printers - Java 2D Graphics

Java examples for 2D Graphics:Print

Description

lookup All Printers

Demo Code


//package com.java2s;

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

public class Main {
    public static void lookupAllPrinters() {
        final PrintService[] printServices = PrintServiceLookup
                .lookupPrintServices(null, null);
        System.out.println("Number of print services: "
                + printServices.length);
        for (final PrintService printer : printServices) {
            System.out.println("Printer: " + printer.getName());
        }/* w w  w  .j  a v  a  2  s  .  c om*/
    }
}

Related Tutorials