如何显示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[],其中包含系统可用的所有打印机。
关于java - java中如何获取打印机列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15274328/