flutter_xprinter_tspl_sdk
Windows Flutter plugin for XPrinter TSPL / TSPL2 label printers.
This package keeps label printing separate from flutter_xprinter_sdk, which
continues to focus on ESC/POS receipt printers.
Platform support
| Platform | Status |
|---|---|
| Windows | Supported through XPrinter Windows SDK 2.0.4 TSPL emulation |
| Android | Not registered |
| iOS | Not registered |
Transports
await TsplConnection.connect(
type: XprinterTsplConnectionType.usb,
address: '', // first USB printer, maps to "USB,"
);
await TsplConnection.connect(
type: XprinterTsplConnectionType.tcp,
address: '192.168.1.20', // maps to "NET,192.168.1.20"
);
await TsplConnection.connect(
type: XprinterTsplConnectionType.serial,
address: 'COM1,9600',
);
Print a label
await TsplConnection.connect(
type: XprinterTsplConnectionType.tcp,
address: '192.168.1.20',
);
await TsplPrinter.setup(
labelWidthMm: 58,
labelHeightMm: 40,
gapHeightMm: 2,
);
await TsplPrinter.clearBuffer();
await TsplPrinter.text(x: 30, y: 30, text: 'BILLZ TSPL');
await TsplPrinter.barcode(x: 30, y: 80, content: '1234567890');
await TsplPrinter.qrCode(x: 330, y: 40, content: 'https://billz.ai');
await TsplPrinter.print();
await TsplConnection.disconnect();
Raw commands
The Dart layer builds standard TSPL command bytes and the Windows native layer only opens the vendor SDK port and writes bytes. For commands not wrapped yet:
await TsplPrinter.sendCommands([
'SIZE 58 mm,40 mm',
'GAP 2 mm,0 mm',
'CLS',
'TEXT 30,30,"3",0,1,1,"Raw TSPL"',
'PRINT 1,1',
]);