Determine if finished printing using Java
<p>Does anyone know how can I determine if a physical printer finished printing using java? I already tried the Job Listener, Job Watcher, and Job Events but all of these did not work. </p>

<p>Here is the code I used:</p>

<pre><code>private static class PDFPrintJobListener implements PrintJobListener {

    private static final boolean showMessages=false;

    @Override
    public void printDataTransferCompleted(final PrintJobEvent printJobEvent) {
        if(showMessages) {
            System.out.println("printDataTransferCompleted=" + printJobEvent);
        }
    }

    @Override
    public void printJobCompleted(final PrintJobEvent printJobEvent) {
        if(showMessages) {
            System.out.println("printJobCompleted=" + printJobEvent);
        }
    }

    @Override
    public void printJobFailed(final PrintJobEvent printJobEvent) {
        if(showMessages) {
            System.out.println("printJobEvent=" + printJobEvent);
        }
    }

    @Override
    public void printJobCanceled(final PrintJobEvent printJobEvent) {
        if(showMessages) {
            System.out.println("printJobFailed=" + printJobEvent);
        }
    }

    @Override
    public void printJobNoMoreEvents(final PrintJobEvent printJobEvent) {
        if(showMessages) {
            System.out.println("printJobNoMoreEvents=" + printJobEvent);
        }
    }

    @Override
    public void printJobRequiresAttention(final PrintJobEvent printJobEvent) {
        if(showMessages) {
            System.out.println("printJobRequiresAttention=" + printJobEvent);
        }
    }
</code></pre>

<p>I tried to use listeners but no output is received whether the printer finished printing or the printer failed to print the document. I also searched other people's question related to this but nobody knows the answer. There are times when Data Transfer Completed is the only output in the listener. So I want to know how to determine if a printer finished printing a document. Thanks</p>