简体   繁体   English

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

[英]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 ,然后将其传递给JasperReportJRPrintServiceExporter 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.

相关问题 Java 打印 API 向打印机发送命令 - Java print API send commands to printer 打印作业提交给打印机,但没有打印任何内容。 Java的 - Print job submitted to printer, but didn't print anything. Java PDF Java 打印:在打印机作业队列中发送作业但不打印任何内容 - PDF Java print : job sent in printer jobs queue but nothing prints (PDFBox)java.awt.print.PrinterException:打印机不接受作业 - (PDFBox) java.awt.print.PrinterException: Printer is not accepting job 使用 JPS(java 打印服务)在特定打印机上打印文档 - Print a doc on specific printer using JPS( java print service) Java打印代码正常工作,发送到打印机但不打印任何内容(Python中的Java) - The java printing code is working,send to printer but not print anything(java in python) 如何以编程方式在将普通 Windows 打印队列“假脱机文件”发送到打印机之前编辑假脱机文件头? - How to programmatically achieve editing of the spool file header of the normal windows print queue 'spool file' before it is sent to the printer? 在带有打印服务的Java上的ubuntu上找不到打印机 - Can't find printer on ubuntu from java with print service 从JAVA类将RTF文件直接后台处理到Lipi打印机 - Spool a RTF file directly to a Lipi printer from a JAVA class javax.print.PrintException:打印机不接受作业 - javax.print.PrintException: Printer is not accepting job
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM