Java print service API: send job to printer?

I am using the Java print service API to select PrintServiceand then pass it to JasperReport JRPrintServiceExporter. The basic idea is simply to send the document to the one provided PrintService. Actually used java.awt.print.PrinterJob.print().

It looks like you cannot send a print job to a printer with an attribute PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBSwhen it is disabled or disabled. If I sent him a task, I would receive PrinterException, because he does not accept the task,

Can I print "NOT_ACCEPTING_JOBS" on the printer? In a real operating system, this works; the task is queued in the pool. How to achieve the same effect using the print APIs?

+3
source share
1 answer

I think the problem you are trying to solve is similar to this error . The problem is that Java 1.5 and 1.6 are looking at the wrong flags (instead of the printer queue).

The solution that seems to be to use the ForceAcceptPrintService described in this forum . On the other hand, this post mentions a workaround using byte manipulation, but I have not tried this solution myself.

+1
source

Source: https://habr.com/ru/post/1772019/


All Articles