Link to home
Start Free TrialLog in
Avatar of stawse
stawse

asked on

ZPL II - Printing label automatically

Hello Everyone,

I am new to the ZPL II programming and I am trying to set a simple label setup that will print a simple line of text (Please see the code below).

I can print the label without any issues but what I really want is being able to make the printer print the label automatically.

So, I have created the label form and store it in the printer. When I go to the printer I can select the form and then I have to confirm the quantity and then select GO on the printer Menu so it will print.

I need to avoid this last steps. I want the quantity to come straight from the label (already done) and then I want it to enter the "GO" also from the label, I don't want to press any button so the label will print.

How can I achieve this goal?

Pinter: Zebra ZT410 203dpi ZPL
Firmware: V75.19.7Z

Your help will be very appreciated.

Thanks in advance,
-SC

----------------------------------CODE--------------------------------
^XA^LH30,30
^FO20,10^ADN,100,20^FDMyNameIS...^FS
^LH0,0
^PQ1 // Defining Quantity

//Missing command to order the print...//
^XZ
Avatar of hdhondt
hdhondt
Flag of Australia image

I'm not really familiar with ZPL but, as everyone else seems to be ignoring this question, I'll see if I can contribute anything.

You seem to have done things correctly: your code starts with ^XA and ends with ^XZ. That should be all that's required to print a label. Except that in your case it doesn't.

You say you stored the label in the printer.  I'm guessing that, if you do that, the printer does want some front panel or other command action before it prints.

Try this instead: put all the commands in a file (use any text editor, including Notepad) and then send that file to the printer. That should then print. Sending it to the printer depends on how the printer is connected, but you should be able to use the same method you used before.
Assuming you stored the form using the DFR command:

^XA                                                          (^XA - This is the Start Command)
^DFR:Format1.ZPL^FS                          
^FO50,50^A0,60,60^FDTest^FS       (FO is font location, A is Font, FD is Data used)
^XZ                                                           (^XZ - This is the End Command)

You can print the stored format by sending this command:

^XA^XFR:Format1.ZPL^FS^XZ

Here's a document that demonstrates how to work with stored formats:

https://km.zebra.com/kb/index?page=content&id=SO8476

You don't have to store a label format in order to use it.  You can just send the label to the printer each time you want to print it.

- Gary
Avatar of stawse
stawse

ASKER

Thanks for your comments, to both of you.

Actually I was taking this step by step but what I really want to achieve is to have a barcode scanner connected to the printer and then scan a barcode and having the printer printing the same barcode. This is my goal.

So, you're saying that I can send a txt file to the printer and then use commands from the scanner to print it, is that it?

I'll give a try by following the link and then I'll let you know.

Thanks again,
-SC
I'm saying that ZPL is ultimately just text.  If you can create a text document that contains the ZPL, you just send it to the printer using one of the protocols that particular printer supports.

Interfacing directly between a scanner and a printer is a more complex chore.  Best approach probably varies depending on the scanner and the printer.

Some Zebra printers have a programming language called ZBI built in.  You may be able to use ZBI to talk to a scanner.

Zebra has a manual that covers a lot of this:

https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf

- Gary
ASKER CERTIFIED SOLUTION
Avatar of stawse
stawse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stawse

ASKER

After some discussion with zebra as well I know it's possible but we need to use the RS232 cable instead of usb cable.