需要修改esc pos encoder

624 阅读1分钟

有错误

*/

    barcode(value, symbology, height) {
        const symbologies = {
            'upca': 0x00,
            'upce': 0x01,
            'ean13': 0x02,
            'ean8': 0x03,
            'coda39': 0x04,
            'itf': 0x05,
            'codabar': 0x06,
             
        };

        if (symbology in symbologies) {
            let bytes = iconv.encode(value, 'ascii');

            this._queue([
                //  0x1d, 0x68, height,
                0x1d, 0x48, 0x01,
                // 0x1d, 0x77, symbology === 'code39' ? 0x02 : 0x03,
                0x1d, 0x6b, symbologies[symbology],
                bytes,
                0x00,
            ]);
        } else {
            throw new Error('Symbology not supported by printer');
        }

       
``` return this;
    }