How to print price without specyfing location of every part of the text? (ZPL) - zebra-printers

The effect he wants to get is:
The price is normally printed
Near the price I want to print the rest of the price in superscript
At the end I want to place currency in subscript.
The problem is that I don't want to specify the location of every part of text.
^XA
^PW480
^FS
^JMA
^MMT
^LS0
^MTD
^CI28
^FO40,11
^FWN
^CF0,16.2,20.7
^FD2144
^FS
^CI28
^FO80,10
^FWN
^CF0,8,8
^FD00
^FS
^CI28
^FO100,10
^FWN^CF0,16.2,17.25
^FDEUR
^FS
^XZ
So the question is that possible to print text after text specifying location only once? Without specifying location to every part of the text?

Use ^FT instead of ^FO, and only specify the X coordinate for the first ^FT.
By default, ^FT resumes at the point where the previous formatting operation finished, and you can provide a manual override to the X and Y components separately, so you would only provide the Y override for the subsequent ^FTs and let it calculate the X automatically:
^FT40,11^A0,16.2,20.7^FD2144^FS
^FT,6^A0,8,8^FD00^FS
^FT,11^A0,16.2,17.25^FDEUR^FS
Note that you will need to adjust the Y coordinate down, because ^FO lines up with the top of the text line (letters hanging from it) and ^FT lines up with the bottom (letters standing on it).
Also note that ^CF changes the printer-wide default font, and there is no point to use it before each command. Use ^A instead as shown. You don't need to set ^CI before each command either, it is again a global setting for encoding of the entire label text.

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

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 set label size reserve print

I have some information I want to print out with a label size of 600 however I can't seem to get it to print the opposite way.
zpl code
! U setvar "ezpl.media_type" "mark"
setvar "zpl.label_length" "600"
END
^XA^LH110,10^FWR
^FO400,0^ASR,18,10^FDInformation^FS
^FO350,0^ASR,18,10^FD Instructions:^FS
^FO350,200^ASR,18,10^FD [instructions] ^FS
^FO250,0^ASR,18,10^FD address:^FS
^FO200,0^ASR,18,10^FD [address]^FS
^FO150,0^ASR,18,10^FD [street]^FS
^FO100,0^ASR,18,10^FD [city]^FS
^XZ
the issue I am having is it prints like.
"space" instructions : do this inste
and cuts it off after a few words. I can't seem to do negative x axis values to just force it to start at the beginning.
So is there a way to make it print in reserve?
so its
"way less space now" .xob siht htiw daetsni siht od : snoitcurtsni
Use ^LL to sent the Label Length. You are not setting that in the ZPL that you show as your example. You can see the Zebra ZPL Programming guide to see details on how to use the command. If you want 600 pixels long, then this should be your first line of ZPL:
^XA^LH110,10^LL600^FWR

ZPL to print strike through

Is there a way to use ZPL to print text with a strikethrough (a line through the text)?
I need to be able to print something and indicate that it was there. I have looked through the ZPL programming guide and I have not found any way to alter the font....
An alternative approach would be to draw a line through your text. Here is a sample. You would need to calculate the points of the line based on the coordinates of the text:
^XA
^FT62,93^A0N,42,40^FH\^FDstrikethrough^FS
^FO41,76^GB268,0,5^FS
^PQ1
^XZ
AFAIAA, No.
Could you simply draw a line over the required text? Perhaps you could use or manufacture a downloaded bitmap font which is "struck through?"
OTOH...
To underline - use a monospaced font like AA,AC,AD,AF or AG
Use
^FO350,50^AGR^FDwhatever,milk,butter,salt^FS
^FO340,50^AGR^FD ____ ______^FS
where the underline here is under milk and butter, you can adjust the offset by trimming the FO's X and Y positions by a few dots (10 X here). Naturally, that can be raised for strikethrough, too...

ZPL, Zebra OPOS, POS for .NET

I have ZPL code as follows:
^XA^CI27^LH0,0^BY2^FO250,50^B3N,N,25,N,N^FDU0772287 ^FS
^FO30,50^A0N,35,35^FD$9.99 ^FS
^FO200,80^A0N,25,25^FH^FDBatch 14657, Item 772287K, 2013-May-29 ^FS
^FO30,115^A0N,25,25^FH^FDAccessories for stroller/carseat, Acton ^FS
^FO550,145^A0N,25,25^FH^FDSize: Preschool ^FS
^FO30,145^A0N,25,25^FH^FDDenim, Maternity ^FS^XZ
When sending it to my Zebra GK420d via POS for .NET & Zebra OPOS, this label ends up taking two 4 inch x 1 inch labels instead of just one. Only one line prints on the second label. There is more than enough room on the label to print this text.
Remove the ^CI27 and the ^FH and you will not see this behaviour.
Remove almost any one of the individual pieces of text and you will not see this behaviour.
Change the label at 200,80 to start at 30,80 and you won't see this behaviour.
Change Acton to say Act and you won't see this behaviour.
However, in some of the above scenarios, although it prints on one label, you'll sometimes discover a ^FS appear somewhere, in the standard font (smaller than ^A0N,25,25). In the last variant (and a bunch of others), you'll end up with the end of one of the lines of text written, in the default font, overwriting the start of another line. You'll also sometimes see a ^FS appear in the middle of nowhere.
Because I see this bug with only some textual strings and not others, I suspected some kind of layout bug due to font size calculations, so I tried changing all the text on the label to a W or an I and it does not make any difference.
I'm stumped; this makes no sense to me and it doesn't follow the documentation I have seen online. Furthermore, everything explodes (fonts are ignored, text is overwritten, prints on four stickers, etc.) when:
a linebreak (Windows) is not put after every ^FS
a linebreak is put anywhere else
a space is not put before every ^FS
Do I have a bug in my ZPL? Am I finding a weird bug in the Zebra OPOS library or POS for .NET? Is it just my printer?

Resources