有没有办法检索同一台机器上各种Windows用户帐户安装的所有打印机。
javax.print.PrintServiceLookup类的lookupPrintServices()方法显示可以在Windows的“控制面板”中看到的登录用户的所有打印机。
答案 0 :(得分:-1)
这会有所帮助
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
public class CheckInstalledPrinter {
public static void main (String [] args)
{
PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
System.out.println("Total Services :: " + printServices.length);
for (PrintService printer : printServices)
System.out.println("Printer Name :: " + printer.getName());
}
}