×

vb 对 zebra 888-TT打印机编程

Kalet Kalet 发表于2009-03-20 12:00:14 浏览322 评论0

抢沙发发表评论

 

打印机:zebra 888-TT

控制语言: EPL2 (很多zebra用的ZPL2 )

vb源码:

Private Sub Command1_Click()
Dim id
id = Form1.Text1.Text
If (id <> "") Then
    strsql = "select * from stock where item='" & id & "'"
    open_db (strsql)
       
    If Not rs.EOF Then
   
        Dim p_name
        Dim stock
        Dim check_no
       
        p_name = rs.Fields.Item(1).Value
        stock = rs.Fields.Item(2).Value
        check_no = rs.Fields.Item(3).Value
       
               
        Open App.Path & "\print.ext" For Output As #1
        
        'ZPL 的命令*********************
        Print #1, " "
        Print #1, "N"
       
        Print #1, "A30,5,0,8,1,1,N," & Chr(34) & "图番号" & Chr(34)
        Print #1, Chr(13) + Chr(10)
        Print #1, "A130,5,0,2,1,1,N," & Chr(34) & id & Chr(34)
        Print #1, Chr(13) + Chr(10)
       
        Print #1, "A30,50,0,8,1,1,N," & Chr(34) & "品名" & Chr(34)
        Print #1, Chr(13) + Chr(10)
        Print #1, "A105,50,0,8,1,1,N," & Chr(34) & p_name & Chr(34)
        Print #1, Chr(13) + Chr(10)
       
        Print #1, "A30,95,0,8,1,1,N," & Chr(34) & "棚番号" & Chr(34)
        Print #1, Chr(13) + Chr(10)
        Print #1, "A130,95,0,2,1,1,N," & Chr(34) & stock & Chr(34)
        Print #1, Chr(13) + Chr(10)
       
        Print #1, "A250,95,0,8,1,1,N," & Chr(34) & "入检号" & Chr(34)
        Print #1, Chr(13) + Chr(10)
        Print #1, "A350,95,0,2,1,1,N," & Chr(34) & check_no & Chr(34)
        Print #1, Chr(13) + Chr(10)
       
       
        Print #1, "B30,140,0,3,1,2,70,B," & Chr(34) & id & Chr(34)
        Print #1, Chr(13) + Chr(10)
       
        Print #1, "P1"
               
        Close #1
        FileCopy "print.ext", "lpt1"

'*******************************************************
    Else
        Dim response
        response = MsgBox(" 图番号不存在!", 0, "提示")
    End If
    Call close_db
    Form1.Text1.Text = ""
    Form1.Text1.SetFocus
Else
    Dim alert
    alert = MsgBox(" 请输入图番号!", 0, "提示")
End If
End Sub

EPL2命令说明

EPL2严格区分大小写

A

语法 Ap1,p2,p3,p4,p5,p6,p7,“DATA”
参数 p1=以象素点为单位的水平起始位置

          p2=以象素点为单位的垂直起始位置

          p3=旋转

            Value         Description
              0               No rotation
              1               90 degrees
              2               180 degrees
              3               270 degrees

              4               No rotation
              5               90 degrees
              6               180 degrees
              7               270 degrees

4-7是针对亚洲字体的设置

            p4=字体选择

             Value                   Description
                                      203 dpi                   300 dpi

                1                  20.3 cpi, 6 pts,      25 cpi, 4 pts,
                                     (8 x 12 dots)        (12 x 20 dots)

                2                  16.9 cpi, 7 pts,      18.75 cpi, 6 pts,
                                     (10 x 16 dots)       (16 x 28 dots)

                3                  14.5 cpi, 10 pts,    15 cpi, 8 pts,
                                    (12 x 20 dots)       (20 x 36 dots)

                4                  12.7 cpi, 12 pts,     12.5 cpi, 10 pts,
                                    (14 x 24 dots)        (24 x 44 dots)

                5                  5.6 cpi, 24 pts,       6.25 cpi, 21 pts,
                                    (32 x 48 dots)        (48 x 80 dots)

                6                  Numeric Only         Numeric Only
                                    (14 x 19 dots)         (14 x 19 dots)

                7                  Numeric Only         Numeric Only
                                    (14 x 19 dots)         (14 x 19 dots)

                                            亚洲打印机

                                    Simplified Chinese, Japanese, Korean

                8                   203 dpi fonts : 24 x 24 dots
                                     300 dpi Double-byte fonts : 36 x 36 dots
                                     300 dpi Single-byte fonts : 24 x 36 dots

                                    Traditional Chinese, Japanese
                9                  300 dpi Double-byte fonts: 36 x 36 dots
                                    300 dpi Single-byte fonts : 24 x 36 dots
                                     Korean - Reserved

p5=水平膨胀,值:1-6&8

p6=垂直膨胀,值:1-9

p7=N代表普通,R表示反转图象

"DATA"=数据

B

用于打印标准条码

语法:Bp1,p2,p3,p4,p5,p6,p7,p8,“DATA”

参数 p1=以象素点为单位的水平起始位置

          p2=以象素点为单位的垂直起始位置

          p3=旋转

            Value         Description
              0               No rotation
              1               90 degrees
              2               180 degrees
              3               270 degrees

          p4=条码选择,参见条码表

          p5=窄条的象数宽度,参见条码表

          p6=宽条的象数宽度,参见条码表

          p7=条码的象素高度

          p8=打印可读代码,值 B=是,N=否

          "DATA"=数据

条码表

                    Description                                                    P4             P5            P6
                                                                                          Value        Value        Value

Code 39 std. or extended                                                 3            1-10            Y
Code 39 with check digit                                                  3C         1-10            N
Code 93                                                                               9            1-10            N
Code 128 UCC
Serial Shipping Container Code                                     0            1-10            N
Code 128 auto A, B, C modes                                         1            1-10            N
Code 128 mode A                                                              1A          1-10            N
Code 128 mode B                                                              1B         1-10            N
Code 128 mode C                                                             1C         1-10            N
Code 128 with Deutsche Post check digit4                  1D         2-10            N
Codabar                                                                               K           1-10             Y
EAN8                                                                                     E80       2-4              N
EAN8 2 digit add-on                                                           E82       2-4              N
EAN8 5 digit add-on                                                           E85       2-4              N
EAN13                                                                                   E30       2-4              N
EAN13 2 digit add-on                                                         E32       2-4              N
EAN13 5 digit add-on                                                         E35       2-4              N
German Post Code                                                            2G         3-4              N
Interleaved 2 of 5                                                                 2           1-10            Y
Interleaved 2 of 5 with mod 10 check digit                     2C         1-10           Y
Interleaved 2 of 5 with human readable
check digit                                                                             2D        1-10            Y
Postnet 5, 9, 11 & 13 digit1                                                P             —             N
Planet 11 & 13 digit1                                                           PL          —              N
Japanese Postnet3                                                             J             —             —
UCC/EAN 1282                                                                     1E        1-10           N
UPC A                                                                                    UA0       2-4             N
UPC A 2 digit add-on                                                          UA2       2-4             N
UPC A 5 digit add-on                                                          UA5       2-4             N
UPC E                                                                                    UE0      2-4             N
UPC E 2 digit add-on                                                          UE2      2-4             N
UPC E 5 digit add-on                                                          UE5      2-4             N
UPC Interleaved 2 of 5                                                        2U         1-10          Y
Plessey (MSI-1) with mod. 10 check digit                         L           —             —
MSI-3 with mod. 10 check digit                                           M           —             —
 

 

vb 对 zebra 888-TT打印机编程

群贤毕至

访客