CPCLGenerator class

CPCL指令封装生成器

Constructors

CPCLGenerator({String encoding = 'gbk'})
构造函数 encoding 编码格式 默认gbk

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

abort() Future<CPCLGenerator>
ABORT强制终止会话不打印
addBinary(dynamic cmd, {bool addLineBreak = true}) CPCLGenerator
直接添加原始二进制字节 cmd 字节数组 List<int> / Uint8List addLineBreak 是否追加换行符
addCommand(String cmd, {bool addLineBreak = true}) Future<CPCLGenerator>
添加自定义指令字符串 cmd 指令文本 addLineBreak 是否自动加\r\n换行
addHex(String hexStr) CPCLGenerator
添加十六进制指令 支持空格分隔 如"1B 40" 或连续"1b40"
backspace() CPCLGenerator
退格字符
barcode(CBarcodeOptions options) Future<CPCLGenerator>
打印一维条码
barcodeText(CBarcodeTextOptions options) Future<CPCLGenerator>
设置条码下方注释文本
beep(int duration) Future<CPCLGenerator>
蜂鸣器控制 BEEP
binary() Uint8List
获取最终二进制数据流(直接发给打印机)
bitmap(CBitmapOptions options) Future<CPCLGenerator>
位图打印 CG指令,内置二值化/抖动处理
box(CBoxOptions options) Future<CPCLGenerator>
绘制矩形框 BOX
comment(String comment) Future<CPCLGenerator>
添加注释行 ; 开头打印机忽略
concatSegment(CConcatSegment segment) Future<CPCLGenerator>
添加串联文本片段(需在startConcat之后)
contrast(int level) Future<CPCLGenerator>
设置打印浓度 CONTRAST 0-3
count(int value) Future<CPCLGenerator>
设置文本数字自增/递减 COUNT
country(String country) Future<CPCLGenerator>
设置字符集国家编码 COUNTRY
defineFormat(CDefineFormatOptions options) Future<CPCLGenerator>
定义可复用标签模板 DEFINE-FORMAT
disableBarcodeText() Future<CPCLGenerator>
关闭条码注释文本
end() Future<CPCLGenerator>
END终止指令不打印
endConcat() Future<CPCLGenerator>
结束文本串联 ENDCONCAT
fontGroup(CFontGroupOptions options) Future<CPCLGenerator>
定义字体组 FG指令
form() Future<CPCLGenerator>
FORM打印后走纸到下一页顶部
hex() String
调试用:获取十六进制空格分隔指令字符串
initLabel(CInitLabelOptions options) Future<CPCLGenerator>
初始化标签起始命令 ! 必须每条标签开头调用
inverseLine(CLineOptions options) Future<CPCLGenerator>
绘制反色填充区域 INVERSE-LINE
justification(CJustificationOptions options) Future<CPCLGenerator>
设置文本对齐方式 JUSTIFICATION
leftMargin(dynamic dots) Future<CPCLGenerator>
设置行式打印左边距 LMARGIN
line(CLineOptions options) Future<CPCLGenerator>
绘制直线 LINE
moveRelativeX(dynamic value) Future<CPCLGenerator>
行式打印相对横向移动 RX
moveRelativeY(dynamic value) Future<CPCLGenerator>
行式打印相对纵向移动 RY
moveX(dynamic value) Future<CPCLGenerator>
行式打印绝对横向移动 X
moveY(dynamic value) Future<CPCLGenerator>
行式打印绝对纵向移动 Y
multiline(CMultilineOptions options) Future<CPCLGenerator>
多行文本打印 ML指令
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pace() Future<CPCLGenerator>
启用定步打印 PACE
pdf417(CPDF417Options options) Future<CPCLGenerator>
打印PDF417条码
postFeed(dynamic length) Future<CPCLGenerator>
打印后走纸 POSTFEED
preFeed(dynamic length) Future<CPCLGenerator>
打印前走纸 PREFEED
print() Future<CPCLGenerator>
发送PRINT执行打印
qrCode(CQROptions options) Future<CPCLGenerator>
打印QR二维码
queryPrinterInfo() CPCLGenerator
读取打印机基础信息(十六进制指令)
queryStatusCommand() CPCLGenerator
查询打印机当前状态(缺纸/开盖等)
reset() CPCLGenerator
清空指令队列,重置生成器
setBold(int value) Future<CPCLGenerator>
设置文本加粗 SETBOLD 0-5
setLF(dynamic unitHeight) Future<CPCLGenerator>
设置行式打印行高 SETLF
setLP(CSetLPOptions options) Future<CPCLGenerator>
设置行式打印字体 SETLP
setMag(CSetMagOptions options) Future<CPCLGenerator>
字体放大 SETMAG
setSpacing(dynamic spacing) Future<CPCLGenerator>
设置字符间距 SETSP
setUnits(String unitType) Future<CPCLGenerator>
设置后续指令度量单位
speed(int level) Future<CPCLGenerator>
设置打印速度 SPEED
startConcat(CStartConcatOptions options) Future<CPCLGenerator>
开启文本串联 CONCAT/VCONCAT
string() Future<String>
解码获取最终CPCL指令文本
text(CTextOptions options) Future<CPCLGenerator>
打印普通文本,支持旋转
toString() String
A string representation of this object.
inherited
underline(String mode) Future<CPCLGenerator>
下划线开关 UNDERLINE
useFormat(CUseFormatOptions options) Future<CPCLGenerator>
使用预定义模板并替换占位符 USE-FORMAT
version() Future<CPCLGenerator>
查询打印机固件版本
wait(int delay) Future<CPCLGenerator>
设置打印延迟 WAIT

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

extractColor(Image image, int x, int y) Pixelb
pickAllRGBA(Image image) List<int>
pxRound(int width, int x, int y) int
resetImageRGBA(Image image, List<num> pixels) → void