ZPL Code Get No of Copies #of10 - zpl

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

Related

ZPL code sent to printer prints 2 blank labels before printing the actual label

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

ZPL data printing at label

I have to print data from DATA_FIELD that can contain between 5 to 50 characters
and label can fit just 20 letters
due i have right to left spelling words i have to print always top 20 letters from right other wise ill loose 1st words of customer name and its usually most important because contains name of the customer
for example i have a code
^FO40,240^A#N,40,40,E:DAVIDBD.FNT
^FD%%Depositor%%
^FS
thats depositor name is:
i dont know why its so long name -- can be variable
and i have to print always last 20 letters as:
its so long name --can be variable
will be happy to get any tips or help
Regards
There really isn't much ZPL can do to help. ZPL is really a page description language, not a programming language.
You will need to process the string to the correct length before adding it to your label code. If you are not using a mono spaced font, then you will have to accommodate for the variable character width.
If you are using a monospaced font you simply have to know how many characters will fit in the area you are trying to print.
If you can wrap text, you might make use of the Use the ^FB – Field Block command in the manual

Text is printed incorrectly using ZPL

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.

How to do a zpl batch printing

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

Zebra RW 420 not printing last or first inch using ZPL

Zebra RW 420 not printing last or first inch(depending on rotation) using ZPL.
this link was suppose to give a solution since it is the same symptom; but I've try all combinations of "Back Feed" (~JSN, ~JSA, ~JSB) with no results.
here is my ZPL code(generated from ZebraDesigner print to file command) It doesn't print "Hello 22" completely:
^XA~TA000~JSN^LT0^MNM^MTT^POI^PMN^LH0,0^JMA^PR2,2~SD10^JUS^LRN^CI0^XZ
^XA
^MMT
^PW812
^LL2233
^LS0
^FO272,76^A0N,56,55^FH\^FDHello 11^FS
^FO320,2000^A0N,56,55^FH\^FDHello 22^FS
^PQ1,0,1,Y^XZ
I had the same problems with print output. I ended up abandoning use of ^FO and went with ^FT, and everything has been perfect since. I don't know why ^FO is so temperamental, but ^FT is very straightforward. You get what you expect.
I'd suggest getting rid of that entire first row that ZebraDesigner made. You don't need it.
I've solved the problem with the help of Zebra support.
The actual problem was the var "zpl.label_length" that was set to 2014 instead of 2233; the ^LL command is ignored in this printer and the label length is controlled only by "zpl.label_length".
It printed the whole label(11")after sending the command:
! U1 setvar "zpl.label_length" "2233"

Resources