Android Question Printing on ZEBRA ZQ520

miguelconde

Member
Licensed User
Longtime User
does anyone have experience printing on a zebra printer zq520 or zq500?

I need a example sending the ZPL commands, cause there is not ESC on this models.

Thank You
 

colboy

Member
Licensed User
Longtime User
Hi Miguel. Here's some code I ripped out of an existing program. So it assumes you have opened the BT serial port. Here's the print function I use:

B4X:
Sub BTSend(pText As String)
    Dim lBuffer() As Byte
    lBuffer=pText.GetBytes("UTF8")
    Printer2.Write2(lBuffer,0,lBuffer.Length)
End Sub

And here's one of the labels I print. This has been heavily doctored to remove client and variable specific stuff, but should get you on the right track. It was written for a Zebra ZQ510 printer.

B4X:
BTSend(lSetZPLMode&Chr(13))
BTSend(lSetNeverTimeout&Chr(13))

Dim lSensor1 As String ="! U1 setvar 'media.type' 'label'".Replace(Chr(39),Chr(34))
Dim lSensor2 As String ="! U1 setvar 'media.sense_mode' 'gap'".Replace(Chr(39),Chr(34))
Dim lSensor3 As String ="~jc^xa^jus^xz"
BTSend(lSensor1)
BTSend(lSensor2)
BTSend(lSensor3)
BTSend("^XA")
BTSend("^LH0,0")
            
BTSend("^FO20,80^AFN,24,0^FDDate / Time:^FS")
BTSend("^FO250,80^ABN,24,0^FD 12th December 2021 23:44:00 ^FS")

BTSend("^FO20,200^AFN,36,0^FDTag Number:^FS")
BTSend("^FO250,200^ABN,48,0^FD 123 ^FS")

BTSend("^FO20,290^AFN,36,0^FDCounted Qty:^FS")
BTSend("^FO250,290^ABN,36,0^FD 999 ^FS")
BTSend("^XZ")

The first three variables Sensor 1 through 3 set up the label. I'd recommend you download the printer programming documentation from the Zebra site.

Let me know how you get on.

Colin
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Upvote 0

miguelconde

Member
Licensed User
Longtime User
Thanks Colin, but I wrote my question wrong, the problem is that I cannot connect to the equipment, I use the EREL example with the SERIAL object, but I have not been able to connect. Thanks for your support
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…