admin管理员组文章数量:1618152
如果Java AWT Printing未注册到运行打印应用程序的Windows / Active Directory用户,则它将无法通过路径找到该打印机.您必须通过Windows“设备和打印机”将打印机路径注册为该用户的打印机,以使其可见.然后,您必须运行lookupPrintServices以查看可用的打印机列表,并按列出的确切名称String检索正确的PrintService.
/**
* Retrieve the specified Print Service; will return null if not found.
* @return
*/
public static PrintService findPrintService(String printerName) {
PrintService service = null;
// Get array of all print services - sort order NOT GUARANTEED!
PrintService[] services = PrinterJob.lookupPrintServices();
// Retrieve specified print service from the array
for (int index = 0; service == null && index < services.length; index++) {
if (services[index].getName().equalsIgnoreCase(printerName)) {
service = services[index];
}
}
// Return the print service
re
版权声明:本文标题:java 远程打印机_如何使用Java在网络打印机上打印? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1728778383a1172721.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论