gpt4 book ai didi

java - java中如何获取打印机列表?

转载 作者:行者123 更新时间:2023-11-30 04:28:25 24 4
gpt4 key购买 nike

如何显示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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com