[英]Java print service API: send job to printer spool?
I am using Java print service API to select PrintService
and then pass it to JasperReport
's JRPrintServiceExporter
. 我使用Java打印服务API来选择PrintService
,然后将其传递给JasperReport
的JRPrintServiceExporter
。 The basic idea is to just send a document to the provided PrintService
. 基本思想是将文档发送到提供的PrintService
。 It is actually using java.awt.print.PrinterJob.print()
. 它实际上是使用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. 看起来您无法将打印作业发送到具有PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS
属性的打印机,当它处于脱机状态或关机时如果我向其发送了一个作业,我会得到一个PrinterException
因为它不接受作业。
Is it possible to print to a "NOT_ACCEPTING_JOBS" printer? 是否可以打印到“NOT_ACCEPTING_JOBS”打印机? In actual operating system this works, the job is queued in the pool. 在实际的操作系统中,这是有效的,作业在池中排队。 How to achieve the same effect using Java print service API? 如何使用Java打印服务API实现相同的效果?
I think the problem you are trying to solve is similar to this bug . 我认为你试图解决的问题类似于这个bug 。 The problem seems to be that Java 1.5 and 1.6 looks at the wrong flags (printer instead of queue). 问题似乎是Java 1.5和1.6查看错误的标志(打印机而不是队列)。
A solution that seems to work is to use the ForceAcceptPrintService described in this forum . 似乎有效的解决方案是使用此论坛中描述的ForceAcceptPrintService。 Alternatively, this post mentions a workaround using byte manipulation but I didn't try that solution myself. 或者, 这篇文章提到了使用字节操作的解决方法,但我自己没有尝试过该解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.