koi_printer_command library

koi_printer_command — 打印文档模型 + 指令渲染器。

小票文档 (KoiTicketDocument) → KoiEscPosRenderer 标签文档 (KoiLabelDocument) → KoiTsplRenderer / KoiCpclRenderer

Classes

KoiBarcodeElement
条码元素 (流式, 带对齐)。
KoiBeepElement
蜂鸣器元素。
KoiCashDrawerElement
钱箱元素。
KoiCommandRenderer
指令渲染器接口 — 将 KoiPrintDocument 转换为协议字节。 Command renderer interface — converts a KoiPrintDocument into protocol-specific byte sequences.
KoiCpclRenderer
CPCL 指令渲染器。 Converts KoiLabelDocument (positioned layout) into CPCL byte sequences.
KoiCutElement
切纸元素。
KoiDitherThreshold
图像二值化阈值常量。 用于 KoiLabelImageElement 和 KoiTicketImageElement 的 threshold 属性。 0-255 范围: 值越低,打印越深 (更多黑色); 值越高,打印越浅。 Industry standard default: 128.
KoiDividerElement
分隔线元素。 KoiDividerElement.
KoiEscPosErrorStatus
ESC/POS 错误状态。
KoiEscPosOfflineStatus
ESC/POS 离线原因状态。
KoiEscPosPaperStatus
ESC/POS 纸张状态。
KoiEscPosRenderer
ESC/POS 指令渲染器。 Converts KoiTicketDocument (flow layout) into ESC/POS byte sequences.
KoiEscPosStatusQuery
ESC/POS 实时状态查询工具类。 Utility for ESC/POS DLE EOT real-time status query and response parsing.
KoiLabelBeepElement
标签硬件: 蜂鸣器。
KoiLabelBlockTextElement
段落排版文本元素 (TSPL BLOCK 支持自动换行)。
KoiLabelBoxElement
标签矩形框元素。
KoiLabelCircleElement
矢量圆元素。
KoiLabelCutElement
标签硬件: 切纸。
KoiLabelDiagonalElement
斜线元素。
KoiLabelDocument
标签文档 — 坐标定位布局, 元素为 KoiLabelElement。 Label document using positioned (canvas) layout. KoiLabelDocument.
KoiLabelElement
标签打印元素基类 (sealed)。 Base class for label print elements using positioned (canvas) layout.
KoiLabelEllipseElement
矢量椭圆元素。
KoiLabelFeedElement
标签硬件: 走纸。
KoiLabelForEachElement
标签模板循环元素。
KoiLabelImageElement
标签图片元素 (带 x, y 坐标)。
KoiLabelLineElement
标签直线元素 (TSPL BAR / CPCL LINE)。
KoiLabelPdf417Element
标签 PDF417 二维条码。 TSPL 原生指令: PDF417 x,y,width,height,rotate,option,"data" CPCL 原生指令: PDF417 参数多行格式
KoiLabelPrintElement
标签打印元素 — 触发打印。
KoiLabelReverseElement
标签反白区域元素。
KoiLabelSetupElement
标签初始化元素 — 设置标签尺寸和间距。
KoiLeftMarginElement
左边距元素 — 设置打印区域左边距 (GS L)。 Left margin element — sets the left margin of the print area.
KoiPaperSize
纸张尺寸。 Paper size for ticket printers. 纸张尺寸。 Paper size — standard presets or custom dimensions.
KoiPositionedBarcodeElement
坐标定位条码元素。
KoiPositionedQrCodeElement
坐标定位 QR 码元素。
KoiPositionedTextElement
坐标定位文本元素。 KoiPositionedTextElement.
KoiPrintDocument
打印文档 (sealed) — 小票或标签。 Sealed print document — either a ticket (receipt) or a label.
KoiPrintElement
基础打印元素
KoiPrintFailure
打印失败。 KoiPrintFailure.
KoiPrintResult
打印结果 — sealed class 表示成功或各种失败。 Print result — sealed class representing success or categorized failure.
KoiPrintSuccess
打印成功。
KoiQrCodeElement
QR 码元素 (流式, 带对齐)。 KoiQrCodeElement.
KoiRawBytesElement
原始字节元素 — 直接注入 ESC/POS 字节流。 Raw bytes element — injects raw bytes directly into the ESC/POS stream. KoiRawBytesElement.
KoiRawCommandElement
原始指令元素 — 直接注入 TSPL/CPCL 文本指令。 Raw command element — injects raw text commands (auto GBK + \r\n).
KoiSpacerElement
空行元素。
KoiTextColumn
文本列定义。
KoiTextElement
文本元素。 Single-line text with styling.
KoiTextRowElement
多列文本行元素。
KoiTicketDocument
小票文档 — 流式布局, 元素为 KoiTicketElement。 Ticket (receipt) document using flow layout.
KoiTicketElement
小票打印元素基类 (sealed)。 Base class for ticket (receipt) print elements using flow layout.
KoiTicketForEachElement
小票模板循环元素。
KoiTicketImageElement
图片元素 (小票, 流式, 带对齐)。
KoiTsplRenderer
TSPL 指令渲染器。 Converts KoiLabelDocument (positioned layout) into TSPL byte sequences.

Enums

KoiBarcodeTextPosition
条码下方文字位置。 HRI (Human Readable Interpretation) text position for barcodes.
KoiBarcodeType
条码类型。 Barcode symbology types.
KoiCashDrawerPin
钱箱引脚。 Cash drawer pin selection.
KoiCodePage
打印机字符代码页 (ESC t n)。 Printer character code page selection.
KoiCommandProtocol
打印指令协议类型。 Print command protocol types.
KoiCutBehavior
切纸行为配置。 Cut behavior configuration.
KoiCutMode
切纸模式。 Paper cut mode.
KoiDelayProfile
延迟配置 (不同打印机型号的换装纸时间不同)。 Delay profile for different printer models. Determines pause duration between multi-copy print jobs.
KoiDeviceRole
设备角色。 Device role — determines paper type and form factor.
KoiFontType
字体类型。 Font type selection for ESC/POS printers.
KoiImageDitherMode
图像二值化模式。 Image dithering mode for thermal printing. Floyd-Steinberg is the industry standard for photo-quality output.
KoiImageRenderMode
图片渲染模式。 Image rendering mode for ESC/POS printers.
KoiLabelDirection
标签打印方向 (TSPL 行业标准)。 Label print direction — TSPL standard DIRECTION command.
KoiLabelPaperType
标签纸张类型 (TSPL 行业标准)。 Label paper type — industry standard per TSC TSPL specification.
KoiLabelStyle
标签样式 (6种公司样式)。 Label style — 6 company-specific label layouts. KoiLabelStyle. KoiLabelStyle. 标签样式定义。
KoiPrintStyle
打印样式 (正常/加大)。 Print style — normal or enlarged text.
KoiQrCorrection
QR 纠错等级。 QR error correction level.
KoiQrRenderStrategy
QR 码渲染策略 (6种兼容方案)。 QR rendering strategy — 6 hardware-specific approaches accumulated over 4 years of real-world testing.
KoiQrSize
QR 码大小 (1-8)。 QR code module size.
KoiStubType
存根联类型。 Stub type for multi-copy printing.
KoiTextAlign
文本对齐方式。 Text alignment for flow-layout elements. KoiTextAlign. KoiTextAlign. 文本对齐方式定义。
KoiTextSize
文本大小 (1-8 倍)。 Text size multiplier, maps to ESC/POS GS ! command. KoiTextSize.
KoiUnderlineStyle
下划线样式。 Underline style for text elements.

Extensions

KoiPrintDocumentJson on KoiPrintDocument
KoiPrintDocument JSON 序列化扩展。

Functions

koiLabelElementFromJson(Map<String, dynamic> json) KoiLabelElement
反序列化标签元素。
koiLabelElementToJson(KoiLabelElement element) Map<String, dynamic>
序列化标签元素。
koiPrintDocumentFromJson(Map<String, dynamic> json) KoiPrintDocument
从 JSON Map 构建 KoiPrintDocument
koiPrintDocumentFromJsonString(String source) KoiPrintDocument
从 JSON 字符串构建 KoiPrintDocument
koiTicketElementFromJson(Map<String, dynamic> json) KoiTicketElement
反序列化小票元素。
koiTicketElementToJson(KoiTicketElement element) Map<String, dynamic>
序列化小票元素。