I'm printing some QR codes (from a Ruby script) writing ESC/POS commands to a Epson TM-T20 thermal printer.
BTW, I'm writing a simple ESC/POS commands printer "driver". The printer I'm using an Epson TM-T20 (USB interface) I'm doing some tests from a Windows 7 host, using serialport gem.
All fine about writing ESC/POS commands for print formatted texts and also linear barcodes, but I have problems uinderstanding the command protocol to print QR CODES, using the only available documentation supplyied by Epson (as far as I know), see: http://www.novopos.ch/client/EPSON/TM-T20/TM-T20_eng_qr.pdf
Now, he section concerning QRCodes commands is for me pretty obscure and I was unable to interpreter requested byte sequences; instead I found very helpfull the Nicolas' example I found here: https://code.google.com/p/python-escpos/wiki/Usage
Hacking that useful bytecodes example, I am able to successuffly print QR codes, see:
I https://twitter.com/solyarisoftware/status/464740233008132096
Nevertheless, in general, I'm confused on the ESC/POS message format, especially in case I would insert a long text message (> 400 chars) inside a QR code... It seem that printer reject (do not print) QR codes containing more than 400 chars using this code:
def test_qrcode (printer, text, print_also_text=false, qr_size=6.chr)
s = text.size + 3
lsb = (s % 256).chr
msb = (s / 256).chr
# https://code.google.com/p/python-escpos/wiki/Usage
escpos = ""
escpos << "\x1D\x28\x6B\x03\x00\x31\x43#{qr_size}"
escpos << "\x1D\x28\x6B\x03\x00\x31\x45\x33"
escpos << "\x1D\x28\x6B#{lsb}#{msb}\x31\x50\x30"
escpos << text #
escpos << "\x1D\x28\x6B\x03\x00\x31\x51\x30"
# writing byte streams directly to the serial port
printer.write escpos
end
Does someone can suggest a CLEAR ESC/POS DOCUMENTATION concerning the ESC/POS commands (=bytecodes sequences) to print QRCodes (two-dimensional code ESC/POS commands) ?