How to call another zpl file from the main zpl program - zebra-printers

I have a zpl script to print a logo, which is rather lengthy. Since this script file will be called once per label while printing other barcode labels, I would like to know if there is a way to embed (or import) the logo printing script in the main zpl script. The logo itself is a .png image, which I have converted to a zpl script.

Send logo to the printer. The ^ISR:SAMPLE.GRF^FS is what saves the object to memory. Replace the rest with your logo.
^XA
^FO30,40^ADN,36,20^FDThis is my Logo^FS
^ISR:SAMPLE.GRF^FS
^XZ
Send the label to the printer, recalling the logo. ^ILR:SAMPLE.GRF^FS is what recalls the object from memory
^XA
^ILR:SAMPLE.GRF^FS
^FO150,125^ADN,36,20^FDFormatting Not In Logo^FS
^XZ
Make sure you
Begin and end all streams with the begin and end commands: ^XA (content) ^XZ
Use the memory path/letter that corresponds to the non-volatile memory.

Related

How to center text in ZPL language?

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

ZebraDesigner - Saving zpl code does not actually save code as zpl

title might be a bit weirdly formulated, so let me try to explain:
I use ZebraDesigner 3 Essentials in order to make a label. I then "print to file", which leaves me with a .prn containing code. I also tried the answer from this question:
How to get ZPL code from a ZebraDesigner label?
, leaving me with a .zpl file, which has the same content as the .prn file.
That content is similiar to zpl, but it seemingly is not the same. This is the result of a simple label, where "Text" is in the middle of it:
CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2~SD20^JUS^LRN^CI0^XZ
^XA
^MMT
^PW1046
^LL0267
^LS0
^FO448,96^GFA,00768,00768,00012,:Z64:
eJzl0TEOQiEMBuASho69gb2I4V3rDcRg3sHEm3CEjh2M6PMV0Lg4GBc7fUMD/w8AfzBUq7zZpWF8NfgMnxhlmC+Y8SQPT1dfyBzZCU+bZ0oSbF8w6b7Zpxg3u+Jz0GEWc62ZyzDlYWwu93pP7vur2zniIEi/N0cdGdQywIzHnvPAruzMay9G6X1pUXsHSnjWL/7Yz+YGfRNqLw==:7BBD
^PQ1,0,1,Y^XZ
The second line from the button upwards is the problem, I believe. Around there is where, normally, "Text" would be standing, however, now there's just gibberish.
I absolutly need this to be saved correctly, as I later need to access it via python. Please help me by explaining why this happens, and / or how I can fix this.
You need to use a font that is built into the printer. If you set the font to Zebra 0 you get something like:
CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR4,4~SD22^JUS^LRN^CI0^XZ
^XA
^MMT
^PW812
^LL1218
^LS0
^FT160,391^A0N,135,134^FH\^FDhello^FS
^PQ1,0,1,Y^XZ

Using Generic/Text only driver for Zebra 170Xi4, how to send commands ZPL

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.

Printing Images with ZPL code

I'm using ZDesigner to create my label and generate the zpl code. My label have several text boxes, a barcode, and a logo image.
I used the generated code on this webpage -> http://labelary.com/viewer.html, and the output was fine.
When I send the same zpl code to the printer (GC420D, installed as generic/text only) the logo image it's not printed.
ZDesigner uses the command ^GFA to send the image to the printer, I tried with diferent extensions (.pgn, .jpg and .bmp) and the results is always the same, no logo.
Any ideas why?
generated code:
^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR2,2~SD15^JUS^LRN^CI0^XZ
^XA
^MMT
^PW570
^LL0320
^LS0
^FO220,170^GFA,8000,0800,00020,:Z64:
eJztkjFugzAUhp+dICrUAUsQ1ogJsVXNASzV6dTBSH7KmiN4SMWKsvcOiAlxigw9QIdwnxooGFVl6FCpQ/7Blu3P7/2/ZYCb/pvIm2T37y9XLpk/bRbdUEEMiQUfpe88w+b4MLtcjMOd3XMA1oILIcnfmabnpvSg9GhTTHvuKtcbcty4OZ9z9cCV1h+RKiA8AGI5j5ZJSguT1nKuy/VuxXdAjjOuSJKOo7ZviBcZkEtA2svUNo2rnvOsv/BwQH1yQUczf55XlB2XThxRao9KOiCVM3LUcLRKht5jCpZH4auOiNaufZfaBKnTc5l4Iyfwim2LLX5ga9vWXnNOq6ZMm7FtdthFeZY/nXSkYVlrMRRV49oeUTrjmE/QjAy/MvjwswRBRGkL9jiNId7205De2JNhliECw6Hg9DTfxZX5eYYRBjbXhHU3Ouxdku5vMiY7h8gJLtlb9/mEMrn3xqjo2m5n5zTezuIxE4JlRnKhHHA7CaOlFHMRxpbc3XTTr/QJea9YBw==:F9E4^FS
^FT128,67^A0I,12,14^FH\^FDData de Emiss\C6o^FS
^FT128,129^A0I,12,16^FH\^FD#DOCUMENT#^FS
^FT76,103^A0I,12,16^FH\^FD#VAL#^FS
^FT100,49^A0I,12,16^FH\^FD#DE#^FS
^FT255,50^A0I,12,16^FH\^FD#CE#^FS
^FT408,46^A0I,12,16^FH\^FD#CC#^FS
^FT110,209^A0I,12,16^FH\^FD#Eur#^FS
^FT134,227^A0I,12,16^FH\^FDRecibo n\A7^FS
^FT124,101^A0I,12,16^FH\^FDEur^FS
^FT300,67^A0I,12,19^FH\^FDC\A2digo Entidade^FS
^FT434,67^A0I,14,16^FH\^FDC\A2digo Cliente^FS
^BY2,3,20^FT441,119^BCI,40,Y,N
^FD>;12345678>69^FS
^PQ1,0,1,Y^XZ
here is my answer a little late but it may be useful for someone. I had a problem when performing a print service for an android application, when pasting the zpl code into the text editor I was not noticing that for some reason some blank spaces were being added, I realized until I copied the code and I viewed it here http://labelary.com/viewer.html
after that I remove the blank spaces and the image could be displayed
zpl code with blank spaces

ZPL print barcode with extra text above

I am developing an application that prints labels using Zebra GK420t printer.
I successfully could print Barcode with the text value in the bottom of the Barcode.
However, I was not be able to print extra text above the Barcode.
I am using this command
^XA
^FO20,20^BY2
^BCN,100,Y,N,N
^FDvar^FS
^XZ
[Translated to ZPL from program code]
Which, if var is 'abc123', prints the Barcode with abc123 underneath.
Q: How can for example can I print my name above the Barcode???
If you mean "abc123 above the barcode" then change ^BCN,100,Y,N,N to ^BCN,100,Y,Y,N.
If you mean "Print 'Nabeel' above the barcode" then insert
^CFD^FDNabeel^FS
^FO20,50
After the ^FO20,20 line.
This would select internal font "D" (CFD) and print "Nabeel" at offset 20,20 (the preceding (^FO)) then set the position of the barcode to 20,50 since 20,20 is really close to top-left of the label.
I'll presume you know how to modify your program code.

Resources