ZEBRA ZPL label formats prints quotations along with text - zpl

In our space we use an ACUCOBOL-GT written program which pushes variables such as PHY NAME to a written format. The program then replaces said PHY NAME with the actual name of the pharmacy and then cups pushes the data onto the label, producing an readable output. We use zebra printers with EPL written label formats to print out these pharmacy medication labels.
Recently I wrote a format using ZPL to produce the same label as Im able to customize the data better than with the old EPL.
The only issue Im running into is that now with the ZPL the data prints onto the label between quotation marks.
So instead of it being eg Montagu Pharmacy it prints out as "Montagu Pharmacy ".
an example of the old EPL code is as follow : PHY NAME A010,025,0,4,1,1,N,
and the output of said code is as follow : A010,025,0,4,1,1,N,"MONTAGU PHARMACY "
on the output before printing it shows the quotes as well but as soon as you send it to the printer it removes the quotes and prints without them.
Here is an example of the ZPL code : PHY NAME ^FO100,025,0^A0N,18,30^FD
and here is the output of said code : PHY NAME ^FO100,025,0^A0N,18,30^FD"Montagu Pharmacy "
on the output before printing it shows the quotes and when it prints out onto the label it prints the text along with the quotes.
I understand that the ACUCOBOL-GT program creates the data with the quotations but the EPL never printed them out but the ZPL does.
Is there anything Im doing wrong or that I can do to remove the quotes so that it can print out normally as before.
I would really appreciate any assistance.
Kind regards
Hans Steyn

This is because in EPL the "DATA" to be printed is surrounded by quotes("), while in ZPL it is not, so quotes are printed. You need to remove the quotes as follows:
PHY NAME ^FO100,025,0^A0N,18,30^FDMontagu Pharmacy
References:
EPL (A command)
https://www.servopack.de/support/zebra/EPL2_Manual.pdf
page 41
ZPL (^FD command)
https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf
page 172
EDIT 1
As per your comment, AFAIK there is no way to remove the quotes after the command reaches the printer. So the only way is to have your supplier's software send the command to some custom tool/software you have that will strip the quotes then relay the message to the printer.
[supplier software] -> [custom software] -> [Printer]
I don't know their software, but they could generate a text file that your custom tool would load and remove the quotes for example with a regex like this, that even allows for escaped quotes in the middle of the name if there are any (arrows):
This being said, it is quite surprising that removing quotes requires massive development, especially because they already seem able to generate both EPL and ZPL.

Related

Is there a 'reserved field identifier' or similar, in ZPL?

I've been doing some work with ZPL recently for printing manufacturing barcode labels etc.
We have several fields on a custom label format that get replaced with real world data, by searching for a specific string of text in the raw ZPL, and then replacing it with the correct application data. E.g. field1 just gets replaced by whatever we actually need to print there, before the TCP packet is constructed and put onto the network to perform the actual print.
This works just fine (so far), but I'm concerned what if some of our field data ever matches the format of a ZPL command for example, what happens.
Page 48 of the huge ZPL specification document shows what we are doing too, where xxxxxxxxxxx is the data to be replaced.
^XA
^FO50,50^ADN,36,20^FDxxxxxxxxxxx
^FS
^XZ
Is there no formal 'reserved field' format/identifier of sorts, or doing what we're doing the only option?
E.g. search and replace field1 in the ZPL below.
^XA
^FO50,50^ADN,36,20^FDfield1
^FS
^XZ
If what you have to replace in the ZPL code is the content of a field (text or barcode), you can try a different approach and use the ^FN command which is used as a placeholder for variable fields and it is usually used to store and recall templates from the printer memory.

Can't print the label correctly. There is some extra spaces in the ZPL text field

Can't print the label correctly. There is some extra spaces in the ZPL text field.
There are some spaces between the text fields in line 2 and line 4.
Please kindly help.
^XA^LL496
^PW711
^FT16,50^A0N,20,19^FDL-01,02,03^FS
^FT16,100^A0N,20,19^FDU-01,02,03^FS
^FT16,150^A0N,23,24^FDUSER ID:admin^FS
^FT16,200^A0N,23,24^FDPromise Date:02/15/16^FS
^FT16,250^A0N,23,24^FDDate of Request: 11/14/19 01:48PM^FS
^PQ1,0,1,Y^XZ
Result:
L-01,02,03
U- 01,02,03 <-- Extra space
USER ID:admin
Promise Date:02/15/16 <- Extra space here
Date of Request: 11/14/19 01:48PM
My Zebra printer : Zebra Z4Mplus 203DPI
I have found this message from internet :
http://support.efficientbi.com/knowledge-base/extra-spaces-in-label-text-appear-when-sending-zpl-commands-direct-to-windows-generic-printer-driver-zebra-problem/
"When testing sending ZPL print commands direct to a Zebra printer using Generic Windows print driver, it we noticed that sometimes extra spaces would appear in the sample label. After some research, it was determined that it appears the Generic Windows print driver will cause these extra spaces to be inserted when the ZPL code is sent WITHOUT CRLF breaks."
I am using the "Generic Windows print driver" for my Zebra printing.
Here is the link that I used :
JavaScript: Send raw text to printer - no server requests/method calls, able to work offline, purely clientside
The output format totally mess up in the Zebra printing. On the other hand, the Labelary looks good to me though.
I am using the Java Vaadin framework and call the javaScript to print the ZPL command to use the "Generic Windows print driver". It worked but the format did not look to me. Extra spaces everywhere and some text did not show up at all but it looks OK in Labelary though.
I tried to print the label in client machines with Zebra printer for my Java Vaadin server side application and I finally able to make it printing but don't know why the format looks totally unpredictable.
My label size is : 3.5 inches X 2 inches label.
I can print the whole field now but still got extra space on the output.
^XA^LL496
^PW711
^FT16,209^A0N,20,19^FH^FDL-01,02,03^FS
^FT16,169^A0N,20,19^FH^FDU-01,02,03^FS
^FT16,249^A0N,23,24^FH^FDUSER ID:admin^FS
^FT16,289^A0N,23,24^FH^FDPromise Date: 02/15/16^FS
^FT16,329^A0N,23,24^FH^FDRequest: 11/14/19 01:48 PM^FS
^FT16,369^A0N,23,24^FH^FDMatl: ST30^FS
^FT7,101^A0N,113,112^FH^FDX^FS
^BY4,2.5,59^FT131,87^B3N,N,,Y,N
^FD2246284^FS
^PQ1,0,1,Y^XZ
Here is the image: There are some extra spaces in the print label from Zebra printer.
enter image description here
I know it's an old question.
I had similair problem printing through cups, turned out the default options had margins set in them. Setting them to zero and Long Line Handling to 'Wrap at Right Edge' fixed my problem:
Finally I am able to get rid of this extra spaces by adding \ +\n string at he end of each java script statement.
We need two \\ characters, the first \ character as the escape character to make it working.
Finally I am able to get rid of this extra spaces by adding \ +\n string at he end of each java script statement. We need two \ characters, the first \ character as the escape character to make it working.

GS1-128 barcode with ZPL does not put the AI in ()

i was expecting this command
^FO15,240^BY3,2:1^BCN,100,Y,N,Y,^FD>:>842011118888^FS
to generate a
(420) 11118888
interpretation line, instead it generates
~n42011118888
anyone have idea how to generate the expected output?
TIA!
Joey
If the firmware is up to date, D mode can be used.
^BCo,h,f,g,e,m
^XA
^FO15,240
^BY3,2:1
^BCN,100,Y,N,Y,D
^FD(420)11118888^FS
^XZ
D = UCC/EAN Mode (x.11.x and newer firmware)
This allows dealing with UCC/EAN with and without chained
application identifiers. The code starts in the appropriate subset
followed by FNC1 to indicate a UCC/EAN 128 bar code. The printer
automatically strips out parentheses and spaces for encoding, but
prints them in the human-readable section. The printer automatically
determines if a check digit is required, calculate it, and print it.
Automatically sizes the human readable.
The ^BC command's "interpretation line" feature does not support auto-insertion of the parentheses. (I think it's safe to assume this is partly because it has no way of determining what your data identifier is by just looking at the data provided - it could be 420, could be 4, could be any other portion of the data starting from the first character.)
My recommendation is that you create a separate text field which handles the logic for the parentheses, and place it just above or below the barcode itself. This is the way I've always approached these in the past - I prefer this method because I have direct control over the font, font size, and formatting of the interpretation line.

How to print a pre formatted text in java

i have string like this
31/12/2002
HINDUSTHAN MOTORS LIMITED
THREE LACS SEVENTY SEVEN THOUSAND THREE HUNDRED
EIGHTY SEVEN ONLY
**377387.00
I want to print it in pre-printed cheque.
how to print this pre-formatted text in java.
I have text file which contains the above pre formatted text
my problem is the extension of the file is different (.kris format)
when I open the file in text doc the formatted text becomes one single line.
So, one single line printing in the printer is not acceptable.
I want to send above text to the printer by using the above fixed format.
1.Download blank cheque template in word format (This is the toughest task I would say if you are searching for free template).
2.Replace labels in it by blank spaces(Make sure that blank spaces occupy same number of spaces as labels).
3.In place of values put some identifiers.for ex: in your case,in place of **377387.00 put **$amount,$date in place of date.
4.Save word as pdf.
5.Now with itext in java replace $ values by your actual values.(itext library in java is used to handle pdfs).
Take print and check if it comes properly on blank cheque else do some minor changes to re-align them.

ZPL on an old Zebra 170XI

I have an old Zebra 170Xi that I would like to use to print labels. Note: it is an plain Xi, not Xi4, XiIII, XiIII plus, or even XiII, so it is old.
I know it "works" because at least printing test stuff from the menu does write labels as expected. I have not been able to print anything programmatically.
I've tried the equivalent of a ZPL hello world to the COM port with some redirection on the command line, but nothing came out.
Can someone give a pointer to at least bootstrap sending commands to the printer?
Perhaps you'd like to post your "Hello World"
This one should work:
^XA
^LH30,30
^FO20,10^AD^FDHELLO WORLD^FS
^XZ
Make sure there are no clever drivers - run the port as Text/Generic.
And use a text-editor to create the file above; simply copy it to the printer-port.
Oooh - that may be the problem. If you're using CMD then ^ is an escape character, so
echo ^XA
needs to be
echo ^^XA
Yeah - tough old brutes the 170Xi - got my Zebra stripes on them back in '95...

Resources