What is the best practice to query the printer for each print job?

T Tobia Scapin 3 years 7 months ago
5 0 0

I'm a developer of a Java ticketing software, it sends raw ZPL commands to printers connected via USB (with LinkOS SDK), Ethernet (TCPSocket) or serial. This software is compliant with italian ticketing laws, where each ticket is unique and must be signed with a security smartcard.
The goal in this software is to be as fast as possibile and  prevent printing failure becase the procedure is this:

Getting ticket request from client
Get hash from smartcard
Save details in database
Print the ticket

The most critical is printing step because it is the last one, then if the printer fails I have to justify a smartcard emission without a paper ticket and I cannot undo the smartcard request.
 
For now I wrote a status test method that query the printer with ~HS command, waits few seconds and if the testus arrive in time and is right the job go on. I run it before every ticket.
 
Let's say I have to print many tickets, for each one I send ~HS as first command, wait the printer status, get the hash from smartcard, save details in database, send ZPL job to the printer.
With this procedure am I sure that if the paper ends I can stop the next ticket in time? Am I sure that printer replies to ~HS request after the end of previous print job?
 
Am I following the best practise for my situation?
 
Thank you for your help!

CONTACT
Can’t find what you’re looking for?