koi_printer_command 0.1.0
koi_printer_command: ^0.1.0 copied to clipboard
Print document model and command renderers for koi_printer. Supports ESC/POS, TSPL, and CPCL protocols.
koi_printer_command #
The low-level instruction set and rendering engine for the
koi_printer ecosystem.
Features #
This package provides a pure Dart abstraction over various printer protocols. It is completely decoupled from any connection or physical transport layer, meaning it can be run on Flutter apps, CLI tools, or Dart backend servers.
Supported Protocols:
- ESC/POS: Standard receipt thermal printers (e.g., Xprinter, Gprinter).
- TSPL: Standard label printers (e.g., TSC, Xprinter Label).
- CPCL: Mobile label printers (e.g., Zebra, HPRT).
Architecture #
KoiPrintElement: Abstract UI building blocks (Text, Barcode, QrCode, Image).KoiPrintDocument: A collection of elements defining a complete ticket or label.KoiCommandRenderer: Translates aKoiPrintDocumentinto a rawList<int>byte stream tailored for a specific protocol.
Usage #
final document = KoiPrintDocument.ticket(elements: [
KoiTextElement(text: 'Hello World', bold: true, size: KoiTextSize.size2),
KoiCutElement(),
]);
final renderer = KoiEscPosRenderer();
final bytes = await renderer.render(document);
// Send bytes to printer adapter...