类 ZplCommand


  • public class ZplCommand
    extends Command
    • 构造器详细资料

      • ZplCommand

        public ZplCommand()
    • 方法详细资料

      • getCommand

        public byte[] getCommand()
        获得打印命令
        指定者:
        getCommand 在类中 Command
        返回:
        指令内容
      • getCommandRaw

        public byte[] getCommandRaw()
        获得打印命令
        返回:
        指令内容,不包含标签开始、结束符
      • add

        public ZplCommand add​(java.lang.String cmd)
        添加指令
        参数:
        cmd - 内容
      • add

        public ZplCommand add​(byte[] bytes)
        添加指令
        参数:
        bytes - 内容
      • add

        public ZplCommand add​(java.lang.String cmd,
                              java.lang.Object... params)
        添加格式化指令(自动添加指令前缀)
        参数:
        cmd - 指令标识符
        params - 指令参数
      • addBarcodeAztec

        public ZplCommand addBarcodeAztec​(Rotation rotation,
                                          int scale,
                                          boolean extensible,
                                          int errorLevelOrCompressLevel,
                                          boolean customEncode,
                                          int additionCodeSize,
                                          java.lang.String additionCodeId,
                                          java.lang.String text)
        添加Aztec条码
        参数:
        rotation - 字体旋转
        scale - 放大倍数
        extensible - 扩展码标示
        errorLevelOrCompressLevel - 纠错等级和编码大小/生成样式 01-99 纠错等级百分比(最小值) 101-104 1 到 4 层压缩编码 201-232 1 到 32 层完整编码 300 一个简单的 Aztec 码”Rune”
        customEncode - 手动编码标示
        additionCodeSize - 附加编码数量,1到26
        additionCodeId - 附加 ID 最大长度 24 个字符
      • addBarcode11

        public ZplCommand addBarcode11​(Rotation rotation,
                                       int height,
                                       boolean showText,
                                       boolean showTextAbove,
                                       boolean oneParityBit,
                                       java.lang.String text)
        添加Code11条码(USD-8码)每个字符由三个条和两个空格组成,字符集为 10 个数字和连接符(-) 打印比例调整:2.0 到 3.0 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度(如果旋转,则指长度)
        参数:
        rotation - 旋转角度
        oneParityBit - 一个校验位或两个校验位
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcode39

        public ZplCommand addBarcode39​(Rotation rotation,
                                       int height,
                                       boolean showText,
                                       boolean showTextAbove,
                                       boolean showParityBit,
                                       java.lang.String text)
        打印Code39码 39 码的每个字符由九个元素组成:五个条,四个空和字符间隙,这九个元素中,三个是宽的,六个是窄的 打印比例调整:2.0 到 3.0 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度(如果旋转,则指长度) Code 39 码可以兼容 128 位 ASCII 字符集,参看表 A 和表 B 字符集:数字 0-10,A-Z,space,-,。,$,/,+,%
        参数:
        rotation - 旋转角度
        showParityBit - 显示校验位
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcode49

        public ZplCommand addBarcode49​(Rotation rotation,
                                       int height,
                                       boolean showText,
                                       boolean showTextAbove,
                                       char mode,
                                       java.lang.String text)
        打印Code49码 (Code 49 码)是一种多行、连续、可变长的兼容 128 位全 ASCII 字符集的条码。它较完美的实现了在较小的空间存储了大量的数据。 128 码一般 2 到 8 层,每层由左空白区、层起始符、4 个符号字符、层终止符及右空白区组成。 层与层之间由一个模块的层分隔条分隔。Code 49 码的每个符号字符可表示 2 个基本字符集中的字符。 各层能以任意次序扫描。打印比例是固定的。
        参数:
        rotation - 旋转角度
        height - 每层高度, 1 到标签高度
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        mode - 开始模式 A =自动模式。打印机分析数据字段并决定起始模式。 0 = 规范字母数字模式 1 = 多种可读字母数字 2 = 规则数字模式 3 = 数字字母组 4 = 规则数字字母变化 1 5 = 规则数字字母变化 2
        text - 内容
      • addBarcodePlanet

        public ZplCommand addBarcodePlanet​(Rotation rotation,
                                           int height,
                                           boolean showText,
                                           boolean showTextAbove,
                                           java.lang.String text)
        打印Planet条码 邮码是所有条码打印机支持的常用条码。条码字符集是 0 – 9
        参数:
        rotation - 旋转角度
        height - 条码高度,1 到 9999
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodePDF417

        public ZplCommand addBarcodePDF417​(Rotation rotation,
                                           int height,
                                           int errorLevel,
                                           int codeColumnNum,
                                           int codeRowNum,
                                           boolean remmoveIndicateAndEndSymbol,
                                           java.lang.String text)
        打印PDF417码 (PDF417)条码命令是一个二维、多层、连续、堆栈的符号码。这种条码可以在每个标签上打印超过 1000 个字节。 它完美地适用于那些需要在读条码时读入大量信息的应用。 代码由 3 到 90 个堆栈层组成,每一层由开始、停止和符号字符构成的码词组成,每个码词包含四个条和四个空。每层最少必须有 3 个码词。 打印比例固定。
        参数:
        rotation - 旋转角度
        height - 每层高度 默认值:由^BY 值确认。其他值:1 到标签高度
        errorLevel - 纠错级别, 0 = 只检测错误。 1到8,纠错能力从小到大。
        codeColumnNum - 编码的数据的列数
        codeRowNum - 编码的数据的行数
        remmoveIndicateAndEndSymbol - 去掉指示和终止符
      • addBarcodeEAN8

        public ZplCommand addBarcodeEAN8​(Rotation rotation,
                                         int height,
                                         boolean showText,
                                         boolean showTextAbove,
                                         java.lang.String text)
        打印EAN-8码 (EAN-8)条码命令是 EAN-13 的缩短版,参见 EAN-13 可以得到更多的关于 EAN 的信息。 EAN 是国际物品编码协会(European Article Number Association)的字母的首位。 每个 EAN-8 的条码符号由四个元素组成:两个条,两个空。 打印比例固定。 ^FD(Field data,字段数据)限制:必须 7 位,ZPLII 自动在大于 7 位时截去超过的部分,在小于 7 位于在前面加上0。 JAN- -8 8 (日本物品编码)系统是 EAN- -8 8 中的特殊应用。在这种情况下,送给打 印机的前两位数据永远是 49 。 EAN-8 字符集:0 到 9
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodeUPCE

        public ZplCommand addBarcodeUPCE​(Rotation rotation,
                                         int height,
                                         boolean showText,
                                         boolean showTextAbove,
                                         boolean showParityBit,
                                         java.lang.String text)
        打印UPC-E码 (UPC-E)条码命令是 UPC 系统的一种变化用于数字系统 0,UPC 是美国统一代码(Universal Product Code)的缩写。 它是 UPC-A 带有压缩 0 的缩短版,这样打印空间就可以减少。通常用于印制小标签。 注意:使用带压缩 0 0 的 的 C UPC 码,用户必须输入满 0 10 位的字符串,I ZPLII 将计算并打印出缩短版 UPC 。 每个 UPC-E 的条码符号由四个元素组成:两个条,两个空。 打印比例固定。 ^FD(Field data,字段数据)限制:必须 10 位字符,5 位制造商代码,5 位产品代码。 UPC-9 字符集:0 到 9。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showParityBit - 显示校验位
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcode93

        public ZplCommand addBarcode93​(Rotation rotation,
                                       int height,
                                       boolean showText,
                                       boolean showTextAbove,
                                       boolean showParityBit,
                                       java.lang.String text)
        打印CODE93码 (Code 93)条码命令是一种变长、连续型符号码。它可就用在许多同 39 码一样的场合。 它使用 128 位全 ASCII码,但由于 ZPLII 不支持 ASCII 的控制代码或 ESC 序列,所以它用以下字符来替代。该代码也叫 USS-93。 控制码:Ctrl $ ZPLII表示:& 控制码:Ctrl % ZPLII表示:% 控制码:Ctrl / ZPLII表示:( 控制码:Ctrl + ZPLII表示:) 每个 Code 93 码的字符由六个元素组成:三个条,三个空。所不同的是,可阅读的注释上将把所用的控制代码了打印出来。 控制码是成对使用的,如须知详情,参阅 93 码规范。 打印比例固定。 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度(如果旋转,则指长度) Code93 字符集:0 到 9、A 到 Z,- . $ / + % & ?( ) space
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showParityBit - 显示校验位
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcode128

        public ZplCommand addBarcode128​(Rotation rotation,
                                        int height,
                                        boolean showText,
                                        boolean showTextAbove,
                                        boolean showParityBit,
                                        Code128Mode mode,
                                        java.lang.String text)
        打印Code128码 (Code 128)条码是一种高密度、变长、连续型字母数字型符号码。它被设计用来对一些复杂的产品标识进行编码。 CODE128 码有三个字符子集。每个子集可对 106 个可打印字符进行编码。所以每个字符在不同的子集有不同的含义。 每个 Code 128 码的字符由六个元素组成:三个条,三个空。所不同的是,可阅读的注释上将把所用的控制代码了打印出来。 注意:控制码是成对使用的,如须知详情,参阅 93 码规范。 打印比例固定。 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度确定。(如果旋转,则指长度)
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showParityBit - 显示校验位
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        mode - 是否UCC匹配模式
        text - 内容
      • addBarcodeEAN13

        public ZplCommand addBarcodeEAN13​(Rotation rotation,
                                          int height,
                                          boolean showText,
                                          boolean showTextAbove,
                                          java.lang.String text)
        打印EAN13码 (EAN-8)条码命令是类似 UPC-A 的条码,它在欧州和日本的零售商场得到非常广泛的应用。 EAN-13 条码有 12 位数据,比 UPC-A 多一个字符,EAN-13 兼容 UPC-A,但有 13 位数字,左手区为 6 位数字。第 13位是校验位。 打印比例固定。 ^FD(Field data,字段数据)限制:必须 12 位,ZPLII 自动在大于 12 位时截去超过的部分,在小于 12 位时在前面加上 0。 EAN-13 使用模 10 法生成校验位进行错误检测。(参见附录 C) 注意:JAN-13(日本物品编码)系统是 EAN-8 中的特殊应用。在这种情况下,送给 打印机的前两位数据永远是 49。 EAN-13 字符集:0 到 9。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodeMicroPDF417

        public ZplCommand addBarcodeMicroPDF417​(Rotation rotation,
                                                int height,
                                                int mode,
                                                java.lang.String text)
        添加微型PDF417码 (微型 PDF417)条码是二维、多层、连续、堆栈型和 PDF417 一样,不同之处在于 PDF417 使用 17 个模块宽的起始符终止符和左右层指示。 而微型 PDF417 使用独特的 10 个模块宽的层地址符来缩短整个条码的宽度。并允许层高尽量低于 2X。 微型 PDF417 设计用于需要增加单位面积的效率,但又不需 PDF417 那样大的数据容量。它最多只打印 44 层 乘 4 列的数据。 ^FD(Field data,字段数据)和^FH(Field Hex)限制:250 个 7-比特的文本字符,150 个 8 比特的十六进制字符,或366 个 4 比特的数字字符。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY设置 1到9999点
        mode - 模式 0-33
      • addBarcodeInterleaved2Of5

        public ZplCommand addBarcodeInterleaved2Of5​(Rotation rotation,
                                                    int height,
                                                    boolean showText,
                                                    boolean showTextAbove,
                                                    boolean oneParityBit,
                                                    java.lang.String text)
        打印交叉25码 交叉二五码)是高密度的、自校验的、连续的、数字的符号。它的每个字符由五个元素组成:五个条或五个空。 这五个元素中,两个是宽的三个是窄的。条码由条和空交叉组成。条码中,每个字符由三个条的两个空组成,字符集为 10 个数字和连接符(-)。 打印比例调整:2.0 到 3.0 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度(如果旋转,则指长度) 由定义可知,交叉二五码的位数必须是偶数。如果是奇数,则打印机自动在接收到的数据前加上 0。 交叉二五码使用模 10 校验法。 字符集:数字 0-10
        参数:
        rotation - 旋转角度
        oneParityBit - 一个校验位或两个校验位
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodeIndustrial2Of5

        public ZplCommand addBarcodeIndustrial2Of5​(Rotation rotation,
                                                   int height,
                                                   boolean showText,
                                                   boolean showTextAbove,
                                                   java.lang.String text)
        打印工业二五码 (工业二五码)条码是自校验,连续的数字型条码。工业 25 码是 25 家族码中最长的条码。 在 ZPLII 中,25 码家族还有交叉 25 码和标准 25 码。 在工业 25 码中,所有信息由条组成。宽条是窄条的宽度的 3 倍。 打印比例:2.0 到 3.0。 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度确定(如果旋转,则指长度) 字符集:数字 0-9,Start(自动),stop(自动)。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodeStandard2Of5

        public ZplCommand addBarcodeStandard2Of5​(Rotation rotation,
                                                 int height,
                                                 boolean showText,
                                                 boolean showTextAbove,
                                                 java.lang.String text)
        打印标准25码 (标准二五码)条码是自校验,连续的数字型条码。在标准 25 码中,所有信息由条组成。 每个条之间的宽度为 2 倍的条宽,宽条是窄条的宽度的 3 倍。 打印比例:2.0 到 3.0。 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度确定(如果旋转,则指长度) 字符集:数字 0-9,Start(内部使用),stop(内部使用)。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodeBKANSICodabar

        public ZplCommand addBarcodeBKANSICodabar​(Rotation rotation,
                                                  int height,
                                                  boolean showText,
                                                  boolean showTextAbove,
                                                  boolean showParityBit,
                                                  char startChar,
                                                  char stopChar,
                                                  java.lang.String text)
        打印ANSI库德巴 (ANSI 库德巴) 条码通常广泛地用于图书馆、药品工业和快递公司的应用中。这种条码也叫作 USD-4 码,NW-7或 27 码。最初是开发来作为价格标牌用的。 每个字符由 7 个元素组成。四个条和三个空。它有两个字符集:(1)数字,(2)控制符,起始符(- : . $ / +) 停止符(A B C D E T N *)。 打印比例:2.0:1 到 3.0:1。 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度(如果旋转,则指长度)
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        showParityBit - 显示校验位
        startChar - 起始符 A,B,C,D,E,N,T,*
        stopChar - 停止符 A,B,C,D,E,N,T,*
        text - 内容
      • addBarcodeLogoMars

        public ZplCommand addBarcodeLogoMars​(Rotation rotation,
                                             int height,
                                             boolean showTextAbove,
                                             java.lang.String text)
        打印LogoMars码 (LOGMARS) 条码在美国国防部中作为39码的一种特殊应用。LOGMARS是后勤自动标识与识读符号应用(Logistics Applications of Automated Marking and Reading Symbols)的缩写。 打印比例:2.0:1 到 3.0:1。 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度确定。(如果旋转,则指长度) 字符集:同 39 码。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodeMsi

        public ZplCommand addBarcodeMsi​(Rotation rotation,
                                        int height,
                                        boolean showText,
                                        boolean showTextAbove,
                                        boolean showParityBit,
                                        ParityMode parityMode,
                                        java.lang.String text)
        打印MSI条码
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        showParityBit - 显示校验位
        text - 内容
      • addBarcodePlessey

        public ZplCommand addBarcodePlessey​(Rotation rotation,
                                            int height,
                                            boolean showText,
                                            boolean showTextAbove,
                                            boolean showParityBit,
                                            java.lang.String text)
        打印Plessey条码 (Plessey) 条码是脉冲宽度调制的,连续的,无自校验的条码。它是 Plessey 条码的一种变形。 每个字符由 8 个元素组成。四个条和四个相邻的空。 打印比例:2.0:1 到 3.0:1。 字符集:0-9,A-F。 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度确定。(如果旋转,则指长度)
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        showParityBit - 显示校验位
        text - 内容
      • addBarcodeQRCODE

        public ZplCommand addBarcodeQRCODE​(boolean enhanceMode,
                                           int scale,
                                           ErrorLevel errorLevel,
                                           int mask,
                                           java.lang.String text)
        打印QR条码 QR条码是在一个正方形范围内用大量的小的正方形模块组成的矩阵图像,在四角的其中三个位置有特殊的正方块辅助判断二维码的大小,位置和旋转角度。 多种符号尺寸选择,四种纠错率可选,用户自定义模块尺寸,可生成多种图像形式。 QR code 模式 1 是原始的技术规格, 而 QR CODE 模式 2 就是象征着一个高级的形式/加强版。 模式 2 有一些额外的特性并且能够自动区别于模式 1。 建议使用模式 2,并且通常应该也是要用模式 2 字符集包括数字的数据, 字母数字数据, 8 位字节数据,以及日本字符
        参数:
        enhanceMode - 是否增强模式,增强模式是模式2
        scale - 放大倍数2(200dpi机器),3(300dpi机器) 1-10
        errorLevel - 纠错级别
        mask - 掩码 0-7
        text - 内容
      • addBarcodeUPCEANExtend

        public ZplCommand addBarcodeUPCEANExtend​(Rotation rotation,
                                                 int height,
                                                 boolean showText,
                                                 boolean showTextAbove,
                                                 java.lang.String text)
        打印UPC/EAN扩展码 (UPC/EAN 扩展)是出版商的 ISBN(国际标准书号)的 2 到 5 位的附加数字。它是 ISBN(国际标准书号)的扩展。 这些扩展字符作为一个独立的条码来打印。 由于扫描器设计用来扫描单独的 UPC 码,尽管扩展符兼容 UPC 码,但还是不能作为 UPC 码的一部分被扫描器识别。 因为 UPC/EAN 扩展码有一个警戒字符(左边,编码为 1011),这个字符用来表示分隔。 打印比例:固定。 字符集:0-9 ^FD(Field Data:数据字段)限制:2 个或 5 个字符,ZPLII 自动截短或在左边添加 0,直到满足要求。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        text - 内容
      • addBarcodeUPCA

        public ZplCommand addBarcodeUPCA​(Rotation rotation,
                                         int height,
                                         boolean showText,
                                         boolean showTextAbove,
                                         boolean showParityBit,
                                         java.lang.String text)
        打印UPC-A码 (UPC-A)条码是固定长度、数字、连续型的条码,它主要用于零售业的包装标签。UPC-A 条码有 11 个数据字符。 一个 8 点的打印头能够按 77%的比例打印条码。要想知道更多,可参考 UPC-A 条码规范。 打印比例:固定。 字符集:0-9 ^FD(Field Data:数据字段)限制:11 个字符,ZPLII 自动截短或在左边添加 0,直到满足要求。 UPC-A 码使用模 10 法来计算生成校验位。
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
        showParityBit - 显示校验位
        text - 内容
      • addBarcodeDataMatrix

        public ZplCommand addBarcodeDataMatrix​(Rotation rotation,
                                               int height,
                                               int quality,
                                               int codeColumnNum,
                                               int codeRowNum,
                                               DataMatrixFormat format,
                                               char esc,
                                               int heightWidthRatio,
                                               java.lang.String text)
        打印Data Matrix条码
        参数:
        rotation - 旋转角度
        height - 分层高度 默认值:由^BY 设置 1到条码高度
        quality - 质量等级 0,50,80,100,140,200 质量等级指的是纠错率增加的图像符号的总量。以 ECC 值作为基准。ECC 为50-140 使用回卷编码,ECC 200 则使用罗门码编码。
        codeColumnNum - 编码列数 9 到 49 奇数只能对质量等级 0 到 140 生效,偶数只能对质量等级 200 生效。 矩阵二维码的行数和列数是自动调整的。有时可能需要强制固定高或者宽达到条码统一的效果, 如果尝试强制定义一个过小的图像,则不会有任何图像输出,如果值大于 49,则行列数调整成 0, 默认使用自动行列调整输出正常图像。如果输入了一个偶数值,则输出无效参数。 如果 a 值小于 9 但不等于 0 或者数据量超过了行列设定大小,不会打印任何图像。如果设置了^CV,输出无效参数。
        codeRowNum - 编码行数 9 到 49
        format - 格式ID
        esc - 转义控制符
        heightWidthRatio - 高宽比,1正方形,2矩形
        text - 内容
      • addBarcodePostNet

        public ZplCommand addBarcodePostNet​(Rotation rotation,
                                            int height,
                                            boolean showText,
                                            boolean showTextAbove,
                                            java.lang.String text)
        打印PostNet条码 (POSTNET,邮政网)条码用于自动分检信件。POSTNET 条码一系列 5 个条,2 高 3 短,对应数字 0 到 9。 打印比例:固定。 字符集:0-9 ^FD(Field Data:数据字段)限制:100+字符。实际总数据由^BY 的比例与标签的宽度(如果旋转,则指长度) 注意:如果 ^CV (代码有效性)被激活,数据字段长度必须为 5 5 ,9 9 ,或 1 11 位。如果是 6 6 位长的话,也可以用空格和“-”
        参数:
        rotation - 旋转角度
        height - 条码高度 默认值:由^BY 设置 1 到 9999 点
        showText - 显示文字内容
        showTextAbove - 在条码上方显示文字
      • setBarcodeDefaultSize

        public ZplCommand setBarcodeDefaultSize​(int width,
                                                float widthHeightRatio,
                                                int barcodeHeight,
                                                java.lang.String text)
        条码字段默认大小 这个命令用来改变窄元素(窄条或窄空)的宽度模块。宽条与窄条的比例与条码的高度。它在一个标签格式中通常是必要的。
        参数:
        width - 模块(窄条)宽 1-10 点
        widthHeightRatio - 2.0 到 3.0,0.1 的增量(对固定比例的条码无效)
        barcodeHeight - 条码高度 1到标签高度 *
      • setCommandFormatPrefix

        public ZplCommand setCommandFormatPrefix​(char prefix)
        设置格式指令前缀 不要设任何和另一个前缀相同的值
        参数:
        prefix - 指令前缀
      • setCommandFormatDelimiter

        public ZplCommand setCommandFormatDelimiter​(char delimiter)
        设置指令内容分隔符
        参数:
        delimiter - 分隔符
      • setCommandPrefix

        public ZplCommand setCommandPrefix​(char prefix)
        设置指令前缀
        参数:
        prefix - 指令前缀
      • setFont

        public ZplCommand setFont​(char fontId,
                                  Rotation rotation,
                                  int width,
                                  int height)
        使用字体编号调用字体,下载字体到EPROM后可通过^CW来设置字体ID 默认字体ID为0,宽度为12,高度为15
        参数:
        fontId - 字体ID 取值范围 0-9 A-Z
        rotation - 字体旋转
        width - 字体宽度,10-1500点或2-10倍
        height - 字体高度,10-1500点或2-10倍
      • setFont

        public ZplCommand setFont​(ZFile fontFile,
                                  Rotation rotation,
                                  int width,
                                  int height)
        使用字体路径调用字体
        参数:
        fontFile - 字体路径 如果不指定字体名,上一个^A@指定的字体仍将发生作用
        rotation - 字体旋转
        width - 字体宽度,10-1500点或2-10倍
        height - 字体高度,10-1500点或2-10倍
      • setFontId

        public ZplCommand setFontId​(char fontId,
                                    ZFile fontFile)
        设置字体ID 所有机内字体有一字符标识如 A、B、C 等。^CW(字体标识)指令分配单个字母字符(A 到 Z 和 0 到 9) 用于下载到DRAM R:的字体,内存卡 B:,EPROM E:,或Flash的 Z:。 如:将DRAM中的文件MYFONT.FNT设置位字体A: ^XA^CWA,R:MYFONT.FNT^XZ
        参数:
        fontId - 字体ID
        fontFile - 字体文件
      • setDefaultFont

        public ZplCommand setDefaultFont​(char fontId,
                                         int width,
                                         int height)
        设置默认字体
        参数:
        fontId - 字体ID,B到H,和0~9。 任何在打印机的字体,包括下载字体,EPROM 贮存字体和字体 A-Z 和 1-9 可通过^CW 选择
        width - 单个字符点宽度 0-9999
        height - 单个字符点高度 0-9999
      • setPrintLanguage

        public ZplCommand setPrintLanguage​(Language Language)
        设置打印的语言
        参数:
        Language - 语言
      • setMemoryDeviceAlias

        public ZplCommand setMemoryDeviceAlias​(java.lang.String b,
                                               java.lang.String e,
                                               java.lang.String r,
                                               java.lang.String a)
        设置可存储设备的别名
        参数:
        b - b设备的别名
        e - e设备的别名
        r - r设备的别名
        a - a设备的别名
      • setCodeValidation

        public ZplCommand setCodeValidation​(boolean enable)
        设置是否开启代码校验功能 CV(代码检验)是一个开关,它打开或关闭代码检验功能。当代码检验打开时,所有的条码数据都将检查以下几种错误情况: • 字符不在字符集中 • 校验位不正确 • 数据字段太长(字符太多) • 数据字段太短(字符太少) • 参数串包含了不正确的参数或丢失参数 检测到非法字符时,打印机将打印一个错误信息和代码来代替代码图像。信息以“INVALID-X”的方式显示,X 是以下的错误代码: C = 字符不在字符集中 E = 校验位不正确 L = 数据字段太长(字符太多) S = 数据字段太短(字符太少) P = 参数串包含了不正确的参数或丢失参数 一旦打开了条码检验功能,^CV 将一直保持作用到下一个^CV 关闭条码检验功能。本命令不永久保存。 注:如果存在不止一个错误,显示第一个错误。
        参数:
        enable - 是否开启校验
      • setTransferDebug

        public ZplCommand setTransferDebug​(boolean debug)
        启动通信调试,开启后打印机会打印接收的原始数据内容
        参数:
        debug - 是否开启通信调试
      • setResolutionZoom

        public ZplCommand setResolutionZoom​(boolean zoomIn)
        设置分辨率
        参数:
        zoomIn - 是否放大一倍
      • setReferencePoint

        public ZplCommand setReferencePoint​(int x,
                                            int y)
        设置标签的坐标原点 默认的标签坐标原点均在标签内容的左上角。^LH 定义的是标签的坐标参考点,任何在这个坐标右侧和下方的区域是可打印区域。 举个例子,如果使用的标签是有预先印制内容,可以使用这个指令把坐标的起始点放在印制内容以外,这样打印的时候就不会跑到印制内容上了。 这个指令影响所有在其后的指令,所以必须放在标签的最开始。
        参数:
        x - X轴坐标原点
        y - Y轴坐标原点
      • setOffset

        public ZplCommand setOffset​(int xOffset,
                                    int yOffset)
        设置标签偏移
        参数:
        xOffset - X轴偏移值,-9999到9999
        yOffset - Y轴偏移值,-120到120
      • setCleanUpAfterPrint

        public ZplCommand setCleanUpAfterPrint​(boolean clean)
        设置打印后清除图像缓冲区,默认清除
        参数:
        clean - 是否清除
      • setDensity

        public ZplCommand setDensity​(int density)
        设置打印浓度
        参数:
        density - 打印浓度,-30到30
      • setTearMode

        public ZplCommand setTearMode​(boolean tear)
        设置是否撕纸模式
        参数:
        tear - 是否撕纸模式
      • setTearOffset

        public ZplCommand setTearOffset​(int offset)
        设置撕纸位置偏移,打印完成后走纸偏移距离
        参数:
        offset - 偏移距离 -120 到 120
      • setPaperType

        public ZplCommand setPaperType​(PaperType paperType,
                                       int blackLineOffset)
        设置纸张类型
        参数:
        paperType - 纸张类型
        blackLineOffset - 黑标起始偏移,只有在黑标纸时才有效, -120到283
      • setPrintMode

        public ZplCommand setPrintMode​(PrintMode printMode)
        设置打印模式,热敏模式和热转印模式
        参数:
        printMode - 打印模式
      • setGlobalLengthUnit

        public ZplCommand setGlobalLengthUnit​(LengthUnit lengthUnit)
        设置全局的长度单位
      • setFeedToBlackLineAfterPrint

        public ZplCommand setFeedToBlackLineAfterPrint()
        设置打印完后走纸到下一个黑标的起始位置
      • setHorizontalMirror

        public ZplCommand setHorizontalMirror​(boolean mirror)
        设置打印内容水平镜像翻转
      • setSize

        public ZplCommand setSize​(int width,
                                  int height)
        设置标签的大小
        参数:
        width - 宽度
        height - 高度
      • setVerticalReverse

        public ZplCommand setVerticalReverse​(boolean reverse)
        设置内容旋转180度
      • setPrintCount

        public ZplCommand setPrintCount​(int cout,
                                        int pauseAfterPrintCount,
                                        int replicateEachSerialNumber,
                                        boolean overridePauseCount)
        设置打印数量 PQ 指令控制批量打印中的一些操作。它可以控制标签的数量,多少张后暂停,同一张有多少份拷贝。
        参数:
        cout - 打印总数
        pauseAfterPrintCount - 多少张后暂停
        replicateEachSerialNumber - 每张拷贝数
        overridePauseCount - 暂停 如果参数设定为 Y,打印机打印不会有暂停操作,如果设定为 N,打印机每打印一组标签就会暂停,直到用户按下 FEED
      • setPrintCount

        public ZplCommand setPrintCount​(int cout)
        设置打印数量
        参数:
        cout - 打印数量
      • setSpeed

        public ZplCommand setSpeed​(int speed)
        设置打印速度
        参数:
        speed - 打印速度,2到5,A到E
      • setPrintStart

        public ZplCommand setPrintStart()
        设置恢复打印 让进入暂停模式的打印机恢复打印过程。这个功能跟在打印机上按 PAUSE 键动作是一致的。
      • setPrintDeviceInfo

        public ZplCommand setPrintDeviceInfo()
        打印配置信息,如纸张设置,版本信息,接口信息,控制符信息和盘符内容等
      • setPrintMemoryInfo

        public ZplCommand setPrintMemoryInfo​(ZFile zFile)
        打印存储设备的目录文件列表
        参数:
        zFile - 存储设备,文件名和后缀可以用*代表通配符
      • setEncoding

        public ZplCommand setEncoding​(ZFile file)
        设置编码表
        参数:
        file - 打印机中的编码表文件
      • setFactoryParameter

        public ZplCommand setFactoryParameter()
        加载出厂默认参数
      • setFactoryInternetParameter

        public ZplCommand setFactoryInternetParameter()
        加载出厂默认参数(网络参数)
      • setSavedParameter

        public ZplCommand setSavedParameter()
        加载保存的参数
      • saveParameter

        public ZplCommand saveParameter()
        保存当前参数,下次开机自动使用保存的参数
      • uploadFont

        @Deprecated
        public ZplCommand uploadFont​(java.io.File fontFile,
                                     ZFile dstFile,
                                     Rotation rotation,
                                     int width,
                                     int height,
                                     int base,
                                     int space,
                                     int characterSize,
                                     java.lang.String copyRight)
        已过时。
        上传点阵字体到打印机
        参数:
        fontFile - 字体文件
        rotation - 字体旋转,目前只支持N
        width - 最大单元的宽度(点)
        height - 最大单元的高度(点)
        base - 单元项的点到字符基准线
        space - 空的宽度或字间距
        characterSize - 字体字符数(这必须符合下载的字符数)
        copyRight - 版权者(最大文本串长度是 63 字符)
      • uploadEncoding

        @Deprecated
        public ZplCommand uploadEncoding​(java.io.File encodeFile,
                                         ZFile dstFile,
                                         int tableSize)
        已过时。
        上传编码表 标准的 Windows TrueType 字体的编码是 Unicode。因此,ZPL 字段数据必须将其他编码转换成 Unicode。 它需要用^DE(下载编码)命令下载一个对照表。这些表由 Ztools for Windows 提供。
        参数:
        encodeFile - 编码文件
        tableSize - 表大小
      • uploadZpl

        @Deprecated
        public ZplCommand uploadZpl​(ZFile dstFile,
                                    java.lang.String zpl)
        已过时。
        上传ZPL格式文本 (下载格式)命令以文本格式保存 ZPLII 格式指令,以后可以用^XF 加上变量来调用。保存的格式中可以包含字段数(^FN),以便将来参考调用。 将格式保存节省了传输时间,但并没有节省格式化时间,因为 ZPL II 是作为文本串保存的,在打印时仍须进行格式化。 如果忽略映象名,默认的名称和扩展名为 UNKNOW.ZPL。在^XA 后马上输入^DF 指令,输入的格式指令就会被保存起来。
        参数:
        zpl - 文件内容,不好含开始、结束符
      • uploadBitmap

        @Deprecated
        public ZplCommand uploadBitmap​(ZFile dstFile,
                                       long size,
                                       int columnSize,
                                       byte[] data)
        已过时。
        上传图片 在解码和打印完参数 size 的字节后,打印机返回一般模式。 注意:当打印机发现图像中有任何指令前缀(^或~)将结束上传图片
        参数:
        size - 图象总的字节数
        columnSize - 每行字节数
        data - ASCII 十六进制串图象
      • uploadBitmapCancel

        @Deprecated
        public ZplCommand uploadBitmapCancel()
        已过时。
        取消上传图片
      • uploadTrueTypeFont

        @Deprecated
        public ZplCommand uploadTrueTypeFont​(ZFile dstFile,
                                             long size,
                                             byte[] data)
        已过时。
        上传TrueType字体 有一些国际字体超过了 256 个可打印字符,这些字体是用~DU 来下载到打印机,作为 TrueType 字体来使用的。 字段块(^FB)命令不支持大型 TrueType 字体。
        参数:
        size - 字体长度的字节数
        data - ASCII十六进制字串的字体内容,必须和size数匹配
      • deleteAllPicture

        public ZplCommand deleteAllPicture()
        从存储中删除所有的图象(标签格式图象和十六进制图象)
      • addEndFlag

        public ZplCommand addEndFlag()
        字段结束标志
      • addTextBlock

        public ZplCommand addTextBlock​(int width,
                                       int height,
                                       int lineSpace,
                                       TextJustification justification,
                                       int hangingIndent)
        添加文本块
        参数:
        width - 宽度
        height - 高度
        lineSpace - 行间距
        justification - 对齐方式
        hangingIndent - 悬挂缩进
      • addText

        public ZplCommand addText​(java.lang.String text)
        添加文本 (字段数据)指令定义字段的数据串。字段数据可以任何可打印字符除了那些指令前缀(如^和~)
        参数:
        text - 打印数据 最长3072
      • addTextESC

        public ZplCommand addTextESC​(char c)
        打印十六进制转义字符 FH(十六进制段)指令允许你在^FD 语句里直接输入任何十六进制值。^FH 指令必须在每个^FD 指令前才能用。 在^FD 语句里,十六进制标识必须在每个十六进制值前。缺省的十六进制标识是下划线(_)。 这指令可以用在任何有数据段的指令里,(如^FD,^FV(段变量),和^SN(串行数据))。
      • addTextReverseColor

        public ZplCommand addTextReverseColor​(java.lang.String text)
        添加黑色反色的文本
        参数:
        text - 内容
      • addTextSpecialSysbol

        public ZplCommand addTextSpecialSysbol​(Rotation rotation,
                                               int width,
                                               int height,
                                               SpecialSysbol specialSysbol)
        添加特殊符号
        参数:
        rotation - 旋转方向
        width - 宽度
        height - 高度
        specialSysbol - 符号
      • setTextId

        public ZplCommand setTextId​(int id)
        设置字段的编号 用于数据段数字。这指令用于贮存格式和调用格式操作。 在贮存格式,^FN 指令用在正常的^FD(数据段)指令的地方。 在调用贮存格式时,用^FN 结合^FD(数据段)指令。
        参数:
        id - 字段编号 0-9999
      • moveTo

        public ZplCommand moveTo​(int x,
                                 int y)
        移动位置
        参数:
        x - X轴的点数
        y - y轴的电点数
      • setTextParam

        public ZplCommand setTextParam​(TextOrientation textOrientation,
                                       int letterSpace)
        设置字段参数
        参数:
        textOrientation - 字段方向
        letterSpace - 字间距
      • setTextCompose

        public ZplCommand setTextCompose​(int x,
                                         int y)
        字段排版
      • setTextVariable

        public ZplCommand setTextVariable​(byte[] value)
        设置可变数据段
        参数:
        value - 被打印的可变数据段 最大字符串长度=3072
      • setTextAlignAndRotation

        public ZplCommand setTextAlignAndRotation​(Rotation rotation,
                                                  TextAlignment textAlignment)
        设置字段的默认方向和对齐方式
        参数:
        rotation - 旋转角度
        textAlignment - 对齐方式
      • addTextSerialized

        public ZplCommand addTextSerialized​(java.lang.String text,
                                            java.lang.String format,
                                            int increment)
        添加格式化字符串
        参数:
        text - 字符内容
        format - 字符格式 格式化字串代码: D 或 d – 十进制数 0-9 H 或 h – 十六进制数 0-9 和 A-F 或 a-f O 或 o – 八进制数 0-7 A 或 a – 英文字母 A-Z 或 a-z N 或 n – 字母加数字 0-9 和 A-Z 或 a-z % - 无用字符或跳过当前字符
        increment - 增量
      • addTextSerialized

        public ZplCommand addTextSerialized​(int text,
                                            int increment,
                                            boolean fillZero)
        添加序列号数字
        参数:
        text - 序列内容
        increment - 增量
        fillZero - 是否填充0
      • addTextBlock

        public ZplCommand addTextBlock​(Rotation rotation,
                                       int width,
                                       int height)
        添加文本块 TB 指令定义一个有长宽的文本框。文本框可以自动换行,如果文本超出了定义的高度,文本会被截掉。这个指令 注意:^TB 会优先处理后续的文本内容,而不是^FB
        参数:
        rotation - 旋转角度
        width - 块宽度
        height - 块高度
      • addComment

        public ZplCommand addComment​(java.lang.String comment)
        添加注释 ^FX(注释)指令是当你要在标签格式中加入信息注解时有效的方式。 任何^FX 指令后的数据到下一脱字号(^)或波浪号(~)指令间在标签格式中无任何结果。
        参数:
        comment - 注释内容
      • addBox

        public ZplCommand addBox​(int width,
                                 int height,
                                 int borderHeight,
                                 boolean filled,
                                 int radius)
        添加矩形框
        参数:
        width - 矩形宽度
        height - 矩形高度
        borderHeight - 边框高度
        filled - 是否填充
        radius - 圆角大小 0-8
      • addLine

        public ZplCommand addLine​(int width,
                                  int height)
        添加直线
        参数:
        width - 线宽
        height - 线高
      • addDiagonalLine

        public ZplCommand addDiagonalLine​(int boxWidth,
                                          int boxHeight,
                                          int lineHeight,
                                          DiagonalLineMode mode)
        添加对角线
        参数:
        boxWidth - 矩形宽
        boxHeight - 矩形高
        lineHeight - 线宽
        mode - 对角线倾斜方式
      • addCircle

        public ZplCommand addCircle​(int radius,
                                    int borderHeight,
                                    boolean filled)
        添加圆形
        参数:
        radius - 圆半径
        borderHeight - 边框大小
        filled - 是否填充
      • addOval

        public ZplCommand addOval​(int width,
                                  int height,
                                  int lineHeight,
                                  boolean filled)
        添加椭圆
        参数:
        width - 宽度
        height - 高度
        lineHeight - 线宽
      • addBitmap

        public ZplCommand addBitmap​(android.graphics.Bitmap bitmap,
                                    BitmapDataFormat dataFormat,
                                    boolean shake)
        添加图片 注意:发送直接二进制和压缩二进制有问题
        参数:
        bitmap - 图片的原图
        shake - 是否抖动处理
      • addBitmap

        public ZplCommand addBitmap​(ZFile srcFile)
        添加图片,从打印机存储中读取图片数据,图片的位置是上一个FO设置的位置
        参数:
        srcFile - 打印机保存的图片文件
      • saveCurrentAsBitmap

        public ZplCommand saveCurrentAsBitmap​(ZFile dstFile)
        保存当前标签内容为图片,一般写在标签的最后
        参数:
        dstFile - 保存的目标文件
      • saveCurrentAsBitmapAndPrint

        public ZplCommand saveCurrentAsBitmapAndPrint​(ZFile dstFile)
        保存当前标签内容为图片并且打印当前内容,一般写在标签的最后
        参数:
        dstFile - 保存的目标文件
      • getUploadedZpl

        public ZplCommand getUploadedZpl​(ZFile file)
        获取上传到打印机的指令文件ZPL
      • getUploadedPicture

        public ZplCommand getUploadedPicture​(ZFile file)
        获取上传到打印机的图片文件CRF
      • getPrinterConfiguration

        public ZplCommand getPrinterConfiguration()
        获取打印机配置信息
      • getPrinterMemoryInfo

        public ZplCommand getPrinterMemoryInfo()
        获取打印机的内存信息
      • getPrinterStatus

        public ZplCommand getPrinterStatus()
        获取打印机的状态信息
      • initMemoryDevice

        public ZplCommand initMemoryDevice​(char device)
        初始化闪存 初始化闪存操作可能持续几分钟,必须等待足够长的时间让打印机初始化闪存,再去做其他操作 todo 使用MemoryDevice代替Char
        参数:
        device - 闪存的盘符
      • deleteFile

        public ZplCommand deleteFile​(ZFile file)
        删除任意对象 ID 命令从存储设备中删除对象,图片,字体和存储的格式。删除对象时可以指定其中一个或者成组删除。 对象的名称和扩展名都可以用*代替,可以很方便实现成组删除的目的 RAM 内的格式一旦删除,则释放的空间可以继续使用。其他盘符内格式删除后空间并不能马上使用,除非做了碎片处理或者存储初始化操作才可以
        参数:
        file - 需要删除的文件,文件名和后缀可用*通配符
      • copyFile

        public ZplCommand copyFile​(ZFile srcFile,
                                   ZFile dstFile)
        复制对象或一组对象到另一个位置