I am able to print the labels by sending zpl commands to the printer.
Now how to do a batch printing of zpl labels programatically.
suppose if have multiple labels to be printed in a single printjob.
You should be able to simply send all the labels together as a single ZPL command string.
Just do an ^XZ command to end the current label
and then ^XA to start the next one.
If the batch of labels are all identical, you can just add the ^PQ command before the ^XZ. The ^PQ command is used to have a single label printed multiple times, so adding ^PQ50 would make the label print 50 times.
Here is an example that will generate a batch of 500 labels. It includes an increment number within a barcode which is also displayed as text.
^XA
^FO250,40^A0N,70,70^FDLPN^FS
^FO30,120^A0N,50,50
^BCN,100,N,N,N
^FD1000001^SFddddddd^FS
^FO200,300^A0N,50,50
^FD1000001^SFddddddd^FS
^PQ500
^XZ
Related
I have the following code which I print a label with the information of a product. But I have the problem that the product name is not centered. It happens to me that if the name is very long, it goes outside the limits of the label and does not appear. What I want is for the name to start from the center and expand along the label and if it exceeds the limits to continue writing on the next line.
I would appreciate any help
^XA
^CF0,30
^FO150,30^FDNombre del Producto^FS
^CF0,60
^FO200,90^FDPrecio^FS
^FX Third section with bar code.
^BY2,2,50
^FO170,180^BC^FD1234789^FS
^XZ
NOTE: This only works if you are using dots as the unit of measurements (this is the default but specified as ^MUd in the example below). If mm is used (^MUm) the center-thingy does NOT work properly (tested on labelary.com and Zebra S4m).
Use ^FB to define a Field Block. From the manual:
The ^FB command allows you to print text into a defined block type
format. This command formats an ^FD or ^SN string into a block of text
using the origin, font, and rotation specified for the text string.
The ^FB command also contains an automatic word-wrap function.
You could view this example at labelary.com or tryit out yourself:
^XA
^MUd
^LH10,10
^CF0,50
^GB500,500,10^FS
^FO0,50 ^FDNormal^FS
^FO0,150 ^FB500,,,L ^FDLeft^FS
^FO0,250 ^FB500,,,C ^FDCenter^FS
^FO0,350 ^FB500,,,R ^FDRight^FS
^XZ
The following ZPL code when sent to a Zebra GX-420D printer with 2"x2" labeld loaded, does 2 very strange things:
Skips the first 2 labels and only prints on the 3rd one
Repeat this (2 blank labels + one with content) one more time, after a short delay.
So in total it uses 6 labels, and the content is only on the 3rd and 6th one.
Here's the code:
^XA
^FX Test for long barcode
^BY1,2,50
^FO20,10^BC^FD>6UIQ-2013P-MR-BU^FS
^XZ
Is there anything in the above code that would cause this phenomenon?
^FS at the end of a commented text is optional.
From ZPL II manual :
The ^FS command denotes the end of the field definition.
Alternatively, ^FS command can also be issued as a single ASCII control code SI (Control-O, hexadecimal 0F).
I eventually figured it out. I was trying to remotely fix this, not having a direct access to the printer and not seeing what it printed and how. But eventually I got access to a printer and then it didn't take long to fix.
It seems that there were some defaults or setting left over from the previous print jobs that cause the problem. I added some resetting of values in front of the printing and after that it properly printed out just one label.
And yes, the ^FS was not needed at the end of the comment with ^FX.
Here is the code that printed out the same thing correctly (there might be some unnecessary commands but this one worked so I left it at that):
^XA~TA000~JSN^MNW^PON^PMN^LH0,000~SD15^XZ
^XA^JUS^XZ
^XA
^MMT
^PW0355
^LL0305
^FX Test for long barcode
^BY1,2,50
^FO20,10^BC^FD>6UIQ-2013P-MR-BU^FS
^XZ
We are wanting to have a label feed after a print job is finished. I know this is possible to do within the Zebra driver, but the issue we had there is it won't select the paper size automatically from the printer.
Is there a way to convert/send the ZPL command using the Printer Properties->Printer Commands-> End Print Job?
The ZPL command I had found to feed a label after a print job is:
^XA
^FD
^XZ
Insuring to put a space after the FD and each command being on its own line.
The best way to print a blank label is to add a ^PH command on your original zpl spool.
https://imgur.com/a/VW1dWw0
The ^PH command causes the printer to feed one blank label.
I'm looking to create a ZPL code to show the sequence of the labels being printed.
In this case i'm printing 10 copies of 1 label.
I want show on the right corner the number of the label
1/10 -- 1st copy
2/10 -- 2nd copy
etc.
Is this possible with ZPL?
I'm already using the ^PQ command to send quantity of copies.
Hope to hear from you!
You could use the Serialization Field (^SF) command.
^XA
^FO250,40^A0N,70,70^FDLabel^FS
^FO150,240^A0N,50,50^FD001^SFddd^FS
^FO250,240^A0N,50,50^FDof^FS
^FO300,240^A0N,50,50^FD100^FS
^PQ100
^XZ
I print a text using ZPL but they are printed incorrectly. It has gaps in the middle. They are printed correctly to the real printer via the ZebraDesigner. But they are wrong when printing via ZPL:
^FT246,70^A0R,16,16
^FB900,2,,
^FDMaisstaerke, Austernuce, Cashewnuss,Pilz, Mais, Lattich, Pack Choi,Sojasprossen^FS
It is printed as 'Maisstaerke, Austernuce, Cashewnuss,Pilz, Mais, Lattich, Pack Choi, Sojasprossen'
(there is a big gap after 'Mais,').
http://screencast.com/t/sTiaxC3cMg
http://screencast.com/t/0QkypnsPyF89
Please help.
Thanks
I'm unable to reproduce the issue, but the field block width seems rather large; you didn't specify any label dimensions in the original post. If you use the following code--a combination from the original post and your comments:
^XA
^PW560
^LL560
^LS0
^FO246,70^GB28,300,,^FS
^FT246,70^A0R,16,16 ^FB300,2,, ^FDMaisstaerke, Austernuce, Cashewnuss,Pilz, Mais, Lattich, Pack Choi,Sojasprossen^FS
^PQ1,0,1,Y
^XZ
I can reproduce what is possibly the issue--the field block automatic word wrapping--by reducing the field block width to 300 dots.
I also drew a box around the block for visualization. You can test in on the Labelary Viewer.
Finally, if you're somehow composing the data make sure there are no special (non printable, such as tab, non-UTF-8 or accented) characters in it, and if so, you will have to pre-escape them.