javax.print.PrintException:打印机不接受作业
我收到“javax.print.PrintException:打印机不接受作业。”
,当我尝试执行时,
printService.createPrintJob().print(
new SimpleDoc(this,
DocFlavor.SERVICE_FORMATTED.PRINTABLE,
docAttributeSet),
printRequestAttributeSet);
我发现一台机器打印到打印机时发生此问题,但另一台机器可以使用相同的 API 调用打印到同一台打印机。我正在查看 Oracle Sun 的错误报告,解释了类似的问题,粘贴在下面。 https://bugs.java.com/bugdatabase/view_bug?bug_id=6525150
但其中提到的解决方法都没有为我解决问题。任何帮助表示赞赏。
I am getting the "javax.print.PrintException: Printer is not accepting job."
, when I try to execute
printService.createPrintJob().print(
new SimpleDoc(this,
DocFlavor.SERVICE_FORMATTED.PRINTABLE,
docAttributeSet),
printRequestAttributeSet);
I am seeing this problem happening for one machine printing to the printer but the other machine is able to print to the same printer using the same API call. I was looking at bug report from Oracle Sun explaining similar problem which is pasted below.
https://bugs.java.com/bugdatabase/view_bug?bug_id=6525150
But none of the workarounds mentioned there is fixing the problem for me. Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
删除并添加打印机可修复错误中提到的问题作为解决方法。这对我有用。
Removing and adding the printer fixes the problem as mentioned in the bug as a workaround. It worked for me.
printerName=printerName.replaceAll("#", "\\");
不要使用默认打印机,如果打印机是默认打印机,则将 '#' 替换为 '//'。由于窗口系统我得到了这个异常,我已经使用上面的代码替换了我的打印机名称,我的问题现在已经解决了。
printerName=printerName.replaceAll("#", "\\");
don't use the default printer and if the printer is default one then replace '#' with '//'. Due to window system I got this exception, I have replaced my printer name by using the above code and my problem is now solved.
虽然这无法解决报告的问题(一台打印机工作而另一台打印机出现故障),但如果打印机由于系统问题(例如打印机碳粉用完)而变得不可用,则可能会报告此错误。在这种情况下,更换碳粉应该可以解决问题。
While this won't resolve the reported issue (where one printer works and the other fails), this error can be reported if the printer becomes unavailable due to a systemic issue, such as if the printer runs out of toner. In this event, changing the toner should solve it.