Java Printer Usage getPrinterNames()

Here you can find the source of getPrinterNames()

Description

get Printer Names

License

Open Source License

Declaration

public static String[] getPrinterNames() 

Method Source Code

//package com.java2s;
/**//from  www  .j  av  a  2  s  .c  o m
 * PrinterUtils.java
 *
 * Copyright (c) 1998 - 2008 BusinessTechnology, Ltd. All rights reserved
 *
 * This program is the proprietary and confidential information of BusinessTechnology, Ltd. and may
 * be used and disclosed only as authorized in a license agreement authorizing and controlling such
 * use and disclosure
 *
 * Millennium Business Suite Anywhere System.
 */

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

public class Main {
    private static PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);

    public static String[] getPrinterNames() {
        String[] result = new String[printServices.length];
        for (int i = 0; i < printServices.length; i++)
            result[i] = printServices[i].getName();
        return result;
    }
}

Related

  1. getJobPriority(int pages, int copies, boolean withDialog)
  2. getOrientationRequested(int value)
  3. getPaperTraysArray(PrintService ps)
  4. getPrinterAttributes(PrintService printer)
  5. getPrinterJobProperties(PrintService ps)
  6. getPrintService(String printername)
  7. getPrintServices()
  8. getResolution(PrintService service, PrintRequestAttributeSet set, boolean tryDefaultIfNull)
  9. getSetting(PrintService service, PrintRequestAttributeSet set, Class type, boolean tryDefaultIfNull)