Last active
May 15, 2020 08:11
-
-
Save lite1979/765161431c08dafdf9eade7eea5d62e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = qz.configs.create("Epson TM88V"); | |
// The QR data | |
var qr = 'https://qz.io'; | |
// The dot size of the QR code | |
var dots = '\x09'; | |
// Some proprietary size calculation | |
var size1 = String.fromCharCode(qr.length + 3); | |
var size0 = '\x00'; // Always 0 unless qr > 256 characters | |
var data = [ | |
'\x1B' + '\x40' + 'John Doe' +'\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A', // Some text and a few line feeds to make sure the initiation and first line are coming through | |
// <!-- BEGIN QR DATA --> | |
'\x1D' + '\x28' + '\x6B' + '\x04' + '\x00' + '\x31' + '\x41' + '\x32' + '\x00', // <Function 165> select the model (model 2 is widely supported) | |
'\x1D' + '\x28' + '\x6B' + '\x03' + '\x00' + '\x31' + '\x43' + dots, // <Function 167> set the size of the module | |
'\x1D' + '\x28' + '\x6B' + '\x03' + '\x00' + '\x31' + '\x45' + '\x30', // <Function 169> select level of error correction (48,49,50,51) printer-dependent | |
'\x1D' + '\x28' + '\x6B' + size1 + size0 + '\x31' + '\x50' + '\x30' + qr, // <Function 080> send your data (testing 123) to the image storage area in the printer | |
'\x1D' + '\x28' + '\x6B' + '\x03' + '\x00' + '\x31' + '\x51' +'\x30', // <Function 081> print the symbol data in the symbol storage area | |
'\x1D' + '\x28' + '\x6B' + '\x03' + '\x00' + '\x31' + '\x52' +'\x30', // <Function 082> Transmit the size information of the symbol data in the symbol storage area | |
// <!-- END QR DATA --> | |
'New York, NY' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' // more line feeds and text to see if we messed up the QR Code syntax |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://qz.io/wiki/2.0-Raw-Printing#escpos-qr-code