This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes PrintJobListener not working properly... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "PrintJobListener not working properly..." Watch "PrintJobListener not working properly..." New topic

PrintJobListener not working properly...

Muthu Ananth

Joined: Jan 22, 2010
Posts: 4

I had used "PrintJobListener" in my code. I have to listen print job was completed or not. But printJobCompleted() method in PrintJobListener was not working.

printDataTransferCompleted() and printJobNoMoreEvents() was called at all times.

Anybody help me. I have attached code with this Forum

Thanks in advance...

Viktor Pergjoka

Joined: Aug 30, 2010
Posts: 20

Alternatively you could program it on your own. You could get the attributes (this is an Set) and there is a value which represents the queue count ("queued-job-count").
You could then check this attribute to see if it is 0, so you would know that the printer finished its job.
If you use this approach, note that changes in the Set will not be modified so if you want to check a change you would have to call the getAttributes() method every time and compare the old Set with the new one.
Also note that because the return type is a Set, the order is not guaranteed to be the same on every call.

Here is an code example:

Viktor Pergjoka

Joined: Aug 30, 2010
Posts: 20
Or you can register for an PrintJobAttributeListener
Consider Paul's rocket mass heater.
subject: PrintJobListener not working properly...
Similar Threads
[PrintService] Pb while printing
Printing to Wireless printer.
PrintJobListener Question
A question on PrintJobListener interface
Windows - Java - Printer - PDF - Status Issue.