Search code examples
thermal-printercodepagesescposqz-tray

how to print indian languages in ESC/POS printer? how to encoding?


I’m using Qz-tray ESC/POS printer.

printer print the Tamil characters like ????????.

Some people say I need to enable encoding the Indian character code page.

How to find the Tamil language code page number?

Sample code:

this.get_dashes('\x2D', 48) + '\x0A',
    '**THANK YOU ! VISIT AGAIN**' + '\x1B' + '\x61' + '\x31'+'\x1b' + '\x2D' + '\x49'+'\n', // center align
    '\x1B' +'\x2D' + '\x49',
    this.get_dashes('\x2D',48) + '\x0A',

Solution

  • According to Epson, the ESC/P character code table for Tamil is 68. Whether or not your printer can recognize this is going to be hardware dependant.

    Unfortunately, I can't find a similar codepage for Java, so you'll need to continue to use hex sequences in your JavaScript code.

    // Use strict 8-bit encoding
    var config = qz.configs.create("Printer Name", { encoding: 'ISO-8859-1' });
    
    var data = [
       /* Toggle Tamil in ESCPOS */
       '\x1B' + '\x74' + '\x44',   // ESC t 68 = Page 68 [Tamil]
    
       /* Sample Tamil text (must be hex, Java can't understand this */
       this.get_dashes('\x2D',48) + '\x0A',
       '**THANK YOU ! VISIT AGAIN**' + '\x1B' + '\x61' + '\x31'+'\x1b' + '\x2D' + '\x49'+'\n', //center align
       '\x1B' +'\x2D' + '\x49',
       this.get_dashes('\x2D',48) + '\x0A',
       // ...
    ];