escpos-ts — A strictly-typed TypeScript port of the python-escpos library for ESC/POS thermal receipt printers.
import { Network, QR_ECLEVEL_M } from 'escpos-ts';const printer = new Network({ host: '192.168.1.100', port: 9100 });await printer.open();printer.hw('INIT');printer.setWithDefault({ bold: true, align: 'center' });printer.textln('My Shop');printer.setWithDefault();printer.textln('Ref: Invoice #INV-10042');printer.barcode('012345678905', 'EAN13');await printer.qr('https://myshop.com', { ec: QR_ECLEVEL_M });printer.cut();await printer.close(); Copy
import { Network, QR_ECLEVEL_M } from 'escpos-ts';const printer = new Network({ host: '192.168.1.100', port: 9100 });await printer.open();printer.hw('INIT');printer.setWithDefault({ bold: true, align: 'center' });printer.textln('My Shop');printer.setWithDefault();printer.textln('Ref: Invoice #INV-10042');printer.barcode('012345678905', 'EAN13');await printer.qr('https://myshop.com', { ec: QR_ECLEVEL_M });printer.cut();await printer.close();
net.Socket
usb
Use ProfileManager.listProfiles to see available profiles and ProfileManager.getProfile to resolve one. Pass the profile name to any printer constructor via the profileName option.
profileName
escpos-ts — A strictly-typed TypeScript port of the python-escpos library for ESC/POS thermal receipt printers.
Quick start
Connection types
net.Socket)usb(libusb)Printer profiles
Use ProfileManager.listProfiles to see available profiles and ProfileManager.getProfile to resolve one. Pass the profile name to any printer constructor via the
profileNameoption.