JAVA sockets - execute PJL command

2.5k Views Asked by At

In Java, I am trying to connect to a printer(Canon iR5050 PCL6) using Sockets, using the host IP with port as 9010. I want to get the status of the printer using PJL command. I write the PJL command (\x1B%-12345X@PJL INFO USTATUS \r\n\x1B%-12345X\r\n) to the socket output stream and try to read the status of the printer from the input stream. No information is read from the input stream. How could this be done? It will be great if somebody can share some samples. Is this possible?

2

There are 2 best solutions below

0
On

I wrote a pjl library for Java. It handles several features, including USTATUS events. I'm currently using it in a proprietary application for monitoring print jobs, actually counting each page printed as it is printed, as well as getting stati from the printer itself.

0
On

LPD

As per the other question Printing in Java using PS file I'm pretty sure your canon will speak LPD, and LPD will report printer status in a more ubiquitous protocol.