Java打印服务API:将作业发送到打印机假脱机?
我使用 Java 打印服务 API 选择 PrintService
,然后将其传递给 JasperReport
的 JRPrintServiceExporter
。基本思想是仅将文档发送到提供的PrintService
。它实际上是使用java.awt.print.PrinterJob.print()
。
似乎您无法将打印作业发送到具有 PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS
属性的打印机,当它处于脱机或关闭状态时如果我向其发送作业,我会收到 PrinterException< /code> 因为它不接受工作。
是否可以打印到“NOT_ACCEPTING_JOBS”打印机?在实际的操作系统中,这是有效的,作业在池中排队。如何使用Java打印服务API达到同样的效果?
I am using Java print service API to select PrintService
and then pass it to JasperReport
's JRPrintServiceExporter
. The basic idea is to just send a document to the provided PrintService
. It is actually using java.awt.print.PrinterJob.print()
.
It seems like you cannot send a print job to a printer that has PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS
attribute, when it is offline or powered off If I sent a job to it, I would get a PrinterException
because it is not accepting jobs.
Is it possible to print to a "NOT_ACCEPTING_JOBS" printer? In actual operating system this works, the job is queued in the pool. How to achieve the same effect using Java print service API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您试图解决的问题类似于此错误。问题似乎是 Java 1.5 和 1.6 查看了错误的标志(打印机而不是队列)。
似乎有效的解决方案是使用 中描述的 ForceAcceptPrintService论坛。或者,
这篇文章提到了使用字节操作的解决方法,但我自己没有尝试该解决方案。
I think the problem you are trying to solve is similar to this bug. The problem seems to be that Java 1.5 and 1.6 looks at the wrong flags (printer instead of queue).
A solution that seems to work is to use the ForceAcceptPrintService described in this forum. Alternatively,
this post mentions a workaround using byte manipulation but I didn't try that solution myself.