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 A question on PrintJobListener interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "A question on PrintJobListener interface" Watch "A question on PrintJobListener interface" New topic

A question on PrintJobListener interface

Andres Delrotti
Ranch Hand

Joined: Aug 11, 2005
Posts: 164
I have this code

PrintService service = PrintService.getDefaultPrintingService;
DocPrintJob job = service.createJob();

PrintJobListener pjlistener = new PrintJobAdapter() {
public void printDataTransferCompleted(PrintJobEvent e) {
System.out.println("Data transfer completed!");
public void printJobNoMoreEvents(PrintJobEvent e) {
System.out.println("No more events!");
public void printJobRequiresAttention(PrintJobEvent e) {
System.out.println("Requires Attention!");
public void printJobFailed(PrintJobEvent e) {
System.out.println("Print Job Failed!");
public void printJobCompleted(PrintJobEvent e) {
System.out.println("Print Job Completed!");


The problem is, the only two events it seems to detect is printDataTransferCompleted() and printJobNoMoreEvents(). It could not detect the other remaining events even if I force those events to happen (ex: trying to print with printer case open, it should have seen the event printJobRequiresAttention() but it didn't).

Am I doing anything wrong? by the way I am using the TSP700II printer.

Thanks. Any form of help would be appreciated
Prakash Subramanian
Ranch Hand

Joined: Feb 03, 2005
Posts: 32
Apart from the parentheses, is this right? . Its an interface and moreover the method too is not part of the interface. I guess its a typo.

Maybe the printer driver could be the problem. Did you try using a different printer or driver?
[ June 09, 2008: Message edited by: Prakash Subramanian ]
Paulo Carvalho
Ranch Hand

Joined: Nov 12, 2008
Posts: 57

I am having the same problem. Did you resolved it?


Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46367
Please start a new thread. Look at this FAQ. Since the last post was in June, the poster might not realise you have replied.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46367
And welcome to JavaRanch
I agree. Here's the link:
subject: A question on PrintJobListener interface
It's not a secret anymore!