I'm creating "labels" for our Zebra ZT410 300Dpi printer. Those are simple ones that contains just Name (variable size max 15 chars) and QR code (Usually same).
So far, I've done this:
^XA^LH0,0^FWb
^MUd,150,300
^A0,65,75^FO100,150^FD
Test
^FS
^FO275,400^BQN,2,10,H^FDMM,A
Test
^FS^XZ
look at picture 1. Text tends to align to right side.
So I tried to modify it like this
^XA^LH0,0^FWb
^MUd,150,300
^A0,65,75^FO100,150^FB0,350,15,C^FD
Test
^FS
^FO275,400^BQN,2,10,H^FDMM,A
Test
^FS^XZ
But instead of centering against label Height, it centers against width and text is now vertical. Look at picture 2.
You can use the ^FB command to center text => https://imgur.com/a/yRKwV7s
^XA
^LH0,0^FWb
^MUd,150,300
^A0,65,75^FO100,0^FB1800,1,0,C,0^FDTest^FS
^A0,65,75^FO200,0^FB1800,1,0,C,0^FDThis is a center text^FS
^FO275,400^BQN,2,10,H^FDMM,ATest^FS
^XZ
Related
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.
I work with labels that have a clear portion and are covered before being affixed to assets. Is it possible to print mirrored text on a Zebra printer mirrored so that we can see the asset number on the back (sticky) side in the clear portion?
You can use the ^FP command to print text reveresed -> ^FPR:
From the ZPL docs (^FP):
^XA
^FO350,50
^FPR,10
^AV
^FDreverse^FS
^XZ
Result:
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...
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.
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?