移动应用程序中的移动打印格式自定义

时间:2015-07-27 04:26:58

标签: c# vb.net windows-mobile zebra-printers

我想打印包含MC75 [Windows Mobile 6]文本和使用蓝牙打印机(Zebra)的收据。

我有这样的代码:工作正常。但我想改变我的打印格式

Private Sub SendZplOverBluetooth(ByVal theBtMacAddress As [String])
        Try

            Dim thePrinterConn As ZebraPrinterConnection = New BluetoothPrinterConnection(theBtMacAddress)
            thePrinterConn.Open()
            Dim zplData As [String] = "^XA^FO50,20^A0N,25,25^FD TestData.^FS^XZ"

            thePrinterConn.Write(Encoding.[Default].GetBytes(zplData))
            Thread.Sleep(500)

            thePrinterConn.Close()
        Catch e As Exception
            MsgBox("Error " & e.Message)
        End Try
    End Sub

这将打印" TestData"。我想制作我的打印格式:

    Event Service
    ONsite Delivery

StandNo:

ITEM            Quantity
-------------------------
AB               1
BC               2
---------Nothing-----------
all goods are received
---------------------
Date : 

那我怎么能为此编写代码呢?感谢您的直接帮助。

提前致谢

2 个答案:

答案 0 :(得分:1)

Looking thru the ZPL II Programming Guide I recommend to use the FieldBlock operator:

^FBw,l,, w=block width in dots, l=maximum number of lines in block (rest of possible args see Programmers Guide). The \& starts a new line

In ZPL II:

^XA
^CF0,30,30^FO25,50
^FB250,4,,
^FD
    Event Service\&
    ONsite Delivery\&
\&
StandNo:\&
\&
ITEM            Quantity\&
-------------------------\&
AB               1\&
BC               2\&
---------Nothing-----------\&
all goods are received\&
---------------------\&
Date : ^FS
^XZ

Dim zplData As [String] = "^XA^CF0,30,30^FO25,50^FB250,4,,^FD"
zplData = zplData+"    Event Service\&"
zplData = zplData+"    ONsite Delivery\&"
zplData = zplData+"\&"
... 
zplData = zplData+"^XZ"
...

答案 1 :(得分:0)

您可以尝试使用Zebra Designer生成主标签。打印出来并选择“文件”aß输出。然后,您在此文件中获取zpl代码。使用此代码,您可以按照自己的意愿工作和自定义。