如何获取java中的打印机列表?
问题描述:
如何显示设备上安装的所有打印机Java
?如何获取java中的打印机列表?
到目前为止找到我的打印机使用:
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]);
不过,我想在控制台中显示,所有打印机。我怎样才能做到这一点?
答
尝试
PrintServiceLookup.lookupPrintServices(null, null);
这将返回的PrintService [],弥漫着系统中所有可用的打印机。
假设lookupPrintServices返回所有打印机,显示数组用户Arrays.toString(services) – orangegoat 2013-03-07 14:57:08