Java打印服务API:将作业发送到打印机假脱机?

发布于 2024-09-29 20:15:39 字数 475 浏览 0 评论 0原文

我使用 Java 打印服务 API 选择 PrintService,然后将其传递给 JasperReportJRPrintServiceExporter。基本思想是仅将文档发送到提供的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ま柒月 2024-10-06 20:15:39

我认为您试图解决的问题类似于此错误。问题似乎是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文