Designing new lables

Ok, this post is far from definitive, but for the labels we use it is good enough.

We use the Zebra ZLn320 to print our barcode labels and it really is an excellent little device, but getting it to do exactly what you want can be a little tedious.

Firstly use zebradesign 2.5 if you can because version 3 does not seem to want to upload templates.  I didn’t go ott with trying because for our purposes there is no advantage of 3 over 2.5 and there are enough hassles with this without inventing new ones for shits and giggles.

I have designed the label in designer with a logo using a png image, a fixed field and a label one variable field for a serial number and left a blank space for the QR code. It looks a bit like this:

I am not going to go into the details of designing it because they are pretty self explanatory albeit for some reason it does not seem to print in the position you would expect no matter how you set it up.  There is a test print functionality built in to designer so you can move it around until you are happy with it.

NOTE: You will need to have the driver for the printer set up in order to do this, again this is not difficult.

Zebra uses a language called ZPL which I assume means Zebra Programming Language (or possibly printer language; I neither know nor care) that is akin to assembly.

Once you are happy with your label then you can save it and upload it to the printer as a template; Save it with a short easy name (8 characters no spaces) as this saves it being truncated when you upload it. Once saved, for the ZLn320, from designer select:

[File]] —> [export to printer] —> [Internal Flash]

This will upload it to the printer without any fanfare, in fact there is no interaction at all, you will have to check to see if it has made it.

Once you are done then you need to open the Zebra Setup Utilities and select “Open Communication with Printer”; this will bring up a dialogue where you can send commands directly to the printer.  Here the first thing you want to do is list the files in order to ensure that your file has uploaded.  To do so issue the command

! U1 do "file.dir" "E:"

and hit [send to printer],   you should be presented with something like”

"
- DIR E:*.* 
* E:ICLAB.ZPL      1175          
* E:JTEKZPL.ZPL      1410          
* E:TT0003M_.TTF    169188          

-  66936320 bytes free E: ONBOARD FLASH 
"

In my case I can see that my file which I named ICLAB is stored in the memory of the printer.  The next thing we want to do is get the field number of the variable field.  Much of the documentation online is vague on this and several suggest printing to a file and then editing and uploading that file manually however this is not strictly necessary as we can determine the field number by querying the uploaded file which will now have field numbers automatically assigned to any variable fields.

To do this issue the command:

^XA^HFE:ICLAB.ZPL^XZ

Change “ICLAB” for the name of the file; This will thing bring up something like:

^LRN^CI0^MMP^PW591^LL0278^LS0^FO256,0^GF<NUL>A,05632,05632,00044,:Z64:eJzt10tu5CAQAFAQI7HkApG4SXOxyHg3yxxhrkJWOUaIcgGWLBjXVAHGTn/S1YtRNi61HLf05JShoAshjjjiiCOO+MFwkNgWYOFSDQAz01oQOjKtK0LyEtYJ8KGFZT0AXk8s2wbBMm3Gq5l5lt5LB56NeFVRmOhmG/wibKCPj8JFgV91faFu6ZE4aGgDWgjVKkyNLISdNfVO5mFTtQaKcAlt2lnZaqHaSDZXa1ebd1a1aXgmmzbr0Pp83U7dTro0G5+q1Vlv869z/XMii4+cVLN+/iXw9bzaW9Nu3Wpls/R/KQ25s7KvCUu2kF2GLWfWrHZG+7xZHB15bm23huw0cnglm5ea71hhw4Zu1bCKrL5l3Riz10J2avM2Vq5vVnfrYbPJo40725+rI1r7Z60Hsjo5tPMNa8jGNV+0c62z6/Z9rUmyVNCUw8VcVKvfR62TxS3Gm3TLQpjE3oYvtaP2Vm0WulW3rNws1pnFpehlubTq3IanC6uvWMDycaU4LBGyY10Mm9CKzeJ6c7NOXi73relWnFsF3fphNRRfKwI2W2vdw9SsGxbnE23G6vn9xUoA/8bYrckqtHVXY1gDmW0t1iHPQnQQDddiApJjadKhWry7FcOmurWzbKHhxQ2cY+fHreNZRdYyrPlfNjxuHWeOVxv41t+nD1ndLafr0vFhKznNkXrcqsyxdXuImmNlt5zGD5sXankMq0ls1kaOLdW6j5ln8TfNvQWGnagHD/6Fk8SJ9ogIrIQd7VMfC6fWaSFr+Fx8YNi2OP+yunvqZnfr79vAgsCBAFbDTkcA05rr+0GdDXC2alEnw3APObaeRnhhgmSfs7DUa8vOCsc/ko224Igjfj7+ATE2ey4=:01E1^FT295,223^A0N,23,24^FB262,1,0^FH\^FDScan the barcode to report^FS
^FT295,251^A0N,23,24^FB262,1,0^FH\^FDa fault with this equipment^FS
^FT315,158^A0N,25,24^FB220,1,0^FH\^FN11"Serial"^FS
^XZ

You will note towards the bottom a field with the name “Serial” which is the name I gave it with designer.  Prepending “Serial” we have “^FN11” which is the field number assigned to the “Serial” field.  Now we have that we can make use of the template when printing our labels.

Moving on to our use of the template we can test it by sending something like

^XA
^XFE:ICLAB.ZPL
^FO20,20
^BQ,2,7
^FD,,https://inplicare.inplico.uk/index.cgi?serial=A5VM021000200&mid=5^FS
^FN11^FDA5VM021000200^FS
^XZ

So the first command ^XA is start, Second ^XF commend tells the printer to use a stored template, the “E” tells it that this template is stored on drive “E:” the rest is the name of the template.

Next we deal with our QR code:

^FO sets the origin (x, y)

^BQ tells us the printer we want a QR Code the comma afterwards is because we leave the first argument unset.  The 2 is the second parameter that tells us that we want to use an enhanced barcode (this is the default and therefore does not really need to be set either.  The third argument is the magnification factor which we have chosen 7 but can be any value between 1 and 10.  There are several other options not mentioned here as this is a very quick overview.

^FD stands for field data and ^FS stands for field separator.  In our example you will note 2 commas after the ^FD command, this is because when using barcodes we could set additional formatting so if we wanted to print a high quality alphanumeric barcode then we could say:

^FDQA,https://inplicare.inplico.uk/index.cgi?serial=A5VM021000200&mid=5^FS

The next bit “^FN11” tells the printer to move to field number 11 on the printer then ^FD is for the data to print in the field followed by ^FS (Field separator)

Finally we finish with ^XZ which tells the printer we are done and it can print the label.

FEEDING ON POWER UP

For some reason my printer ended up feeding a label on startup.  To prevent this you need to use the ^MF command.  Sending commands is very similar to sending print data you start with ^XA and finish with ^XZ

The ^MF command has two options; feed at power up and feed after closing printhead (see the programming manual for the options). I want mine to feed after closing the print head but not on power up so I choose N and C.

Once we have set the value we need to save it, and that is done with the ^JU command to update the configuration and S to save.

So the whole thing is:

^XA^MFN,C^JUS^XZ