Open gilbertfl opened 6 months ago
This has been partially addressed in this commit: DLE EOT requests for printer and paper status are now dealt with.
Here is a list of candidate status codes. The current and obsolete commands are specified as blocking.
These requests do not stop the printing, but a smart client may wait to get a clear status back before starting their print.
Many ESC/POS clients check the printer state or do setup before sending a print. In many cases, the print is not sent until the printer replied to status calls, leading to an empty print.
A typical example is the "handshake" added to version 2.0 after the beta release. The client sends b'\x1b\x40\x1b\x3d\x01\x10\x04\x01' and stops until it receives a byte as answer. Logging the communication with an Epson TM printer has shown that it replies b'\x16' then the client starts sending the receipt that is to be printed.
b'\x1b' is the ESC command which is used for printer control. Some ESC subcommands are used for print formatting; those commands are already dealt with in the escpos-php code.
We will have to add to the JetDirect service some basic ESC command handling to incite the clients to send the real print, without reimplementing the whole ESC/POS protocol in Python. We will also have to design a cutoff between the pre-print requests and print setup which should be sent to the backend.