Api details to get response from printer.


Please guide me on how to get response form printer after sending print command, basically i want to get the result (success / fail) of the latest print sent to the printer.

I came across the methods like: sendAndWaitForResponse, but I am not very much clear about its usage and the type of response it gives.

Is there any callback mechanism available in the SDK to get the printer response after the print.
Any comments, link or sample implementation will be helpful. I using Zebra ZD410.


Submitted by SSi1 on December 13, 2021 Permalink

The sendAndWaitForResponse() API is designed for get the response back from the printer. It's a blocking call until the response is received or times out. Not all the commands to the printer would generate a response. Therefore, the sendAndWaitForResponse() API should be used for getting printer configuration, reading back from RFID, etc. If the content or commands do not generate response, we should use sendFile() or write() on the connection object. If you want to make sure that the label has been printed, you can check the printer's odometer after the call to sendFile() or write() to send the ZPL format to the printer.