Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PrintJobListener not working properly...

 
Muthu Ananth
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

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
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


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:



output:
color-supported
printer-is-accepting-jobs
printer-name
queued-job-count
 
Viktor Pergjoka
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can register for an PrintJobAttributeListener
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic