File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
I agree. Here's the link:
subject: PrintJobListener not working properly...
It's not a secret anymore!