现在的位置: 首页 > 综合 > 正文

条码打印机代码解读!

2013年10月08日 ⁄ 综合 ⁄ 共 2631字 ⁄ 字号 评论关闭
把这两天的学习整理了一下,

下面是关于打印文本的解读,由于没有相关文档,有些是自己估计,如果有错误请帮忙指出:
strText = ""
    strText = strText & "^XA" & vbCrLf //开始标签格式
    strText = strText & "^MCY" & vbCrLf //清除以前的标签
    strText = strText & "^XZ" & vbCrLf //结束打印字段并结束标签格式
    strText = strText & "^XA" & vbCrLf//开始标签格式
    strText = strText & "^LRN^FWN^CFD,24^LH" & m_strOX & "," & m_strOY//设置起点坐标,^LRN表示不反向打印(N表示不反向),^FWN字体方向为正常(N表示正常),^CFD表示采用的字符字体,^LH表示起点坐标
    strText = strText & "^CI0^PR" & m_strSpeed & "^MNY^MTT^MMT^MD" & m_strDarkness & "^PON^PMN" //^CI0指采用国际字符设置0代表USA1^PR表示打印速度,^MNY表示纸类型类Y表示非连续纸,^MTT表示纸种类T表示热传印纸,^MMT表示打印模式T表示撕下,^MD表示标签深度(值在-3030之间),^PMN打印标签镜象N表示不打印镜像
    strText = strText & "^XZ" & vbCrLf
    strText = strText & "^XA" & vbCrLf
    strText = strText & "^A0N,23,24^FO32,11^CI0^FD(P) Part No^FS" & vbCrLf //^A0N字体方向正常N表示正常,^FO表示起点位置,^FD数据字段,^FS段括号(通常做法是在数据后跟^FS指令),^FD ^FS 间的字符为条码右边的内容。
    strText = strText & "^A0N,23,24^FO33,77^CI0^FD(Q) Quantity^FS" & vbCrLf //打印Text(位于条码上面)
    strText = strText & "^A0N,23,24^FO33,216^CI0^FD(B)^FS" & vbCrLf //打印Text
    strText = strText & "^A0N,23,24^FO32,143^CI0^FD(E) Product date + Expire days^FS" & vbCrLf
    strText = strText & "^FO7,3^GB607,334,2,B,0^FS" & vbCrLf //^GB表示图象框,后跟图象框宽度、图象框高度、线的厚度、线的颜色(B表示黑色);--外面的大筐
    strText = strText & "^A0N,23,16^FO288,78^CI0^FD(L) Lot No^FS" & vbCrLf
    strText = strText & "^A0N,39,40^FO506,19^CI0^FDBenQ^FS" & vbCrLf
    strText = strText & "^BY2,2.0^FO32,34^B3N,N,40,N,N^FDP" & pstrItem & "^FS" & vbCrLf //^BY设置高度和宽度;^FDP+ pstrItem + ^FS表示”P”+Partno,打印条码
    strText = strText & "^A0N,23,24^FO161,11^CI0^FD" & pstrItem & "^FS" & vbCrLf //打印Text
    strText = strText & "^A0N,23,24^FO161,76^CI0^FD" & pstrUnitQty & "^FS" & vbCrLf //打印Text
    strText = strText & "^BY2,2.0^FO32,99^B3N,N,40,N,N^FDQ" & pstrUnitQty & "^FS" & vbCrLf //打印条码
    strText = strText & "^A0N,23,24^FO353,143^CI0^FD" & pstrProdDate & "^FS" & vbCrLf //打印Text
    strText = strText & "^A0N,23,24^FO474,143^CI0^FD " & pstrExpDays & "^FS" & vbCrLf //打印Text
    strText = strText & "^BY2,2.0^FO33,167^B3N,N,40,N,N^FDE" & pstrProdDate & " " & pstrExpDays & "^FS" & vbCrLf //打印条码
    strText = strText & "^BY1,2.0^FO144,211^B3N,N,40,N,N^FD" & strControlNo & "^FS" & vbCrLf //打印条码
    strText = strText & "^A0N,21,22^FO176,253^CI0^FD*" & strControlNo & "*^FS" & vbCrLf //*为软连接字号会被直接打出来
    strText = strText & "^BY1,2.0^FO288,99^B3N,N,40,N,N^FD" & pstrLotNo & "^FS" & vbCrLf //打印条码
    strText = strText & "^A0N,23,24^FO423,289^CI0^FD" & pstrRTNo & pstrWareHouse & "^FS" & vbCrLf
    strText = strText & "^BY1,3.0^FO32,274^B3N,N,40,N,N^FD" & pstrReelId & "^FS" & vbCrLf //打印条码
    strText = strText & "^A0N,21,22^FO81,316^CI0^FD*" & pstrReelId & "*^FS" & vbCrLf //打印ReelId
    strText = strText & "^A0N,23,18^FO375,77^CI0^FD" & pstrLotNo & "^FS" & vbCrLf //打印LotNo Text
    strText = strText & "^MCY" & vbCrLf //清除标签
    strText = strText & "^PQ1,0,1,Y" & vbCrLf //^PQ表示打印数量,许可值:1-99,999,999,意义:打印总数1张标签每个序列号只打1张。打印每组数量是0,但在每组间不暂停(Y
strText = strText & "" & vbCrLf

 

抱歉!评论已关闭.