Citizen thermal printer ZPL inconsistent text alignment - zpl

I am having issues with consistency of text alignment printing ZPL between official Zebra hardware and a Citizen CL-S521 (and presumably other Citizen models).
I have a label with 270 degree rotation on some fields that need to be left-aligned, yet the printer is outputting them right aligned. Equally I have some text blocks that are supposed to be right aligned, but are printing left aligned, with an incorrect field origin.
Examples:
^FWB,0
^FO40,570,0^A0,23,24^TBB,450,25FH\^FDThis should be left aligned^FS
And:
^FT790,504,1^A0N,31,31^TBN,90,31^FH\^FDThis should be right aligned^FS
Using an online ZPL viewer and other ZPL-compatible printers, this outputs correctly, just not on the Citizen models.
If anyone else has had a similar issue and resolved it I would be grateful to understand how.

If anyone else comes across this problem, I solved it using the ^FB Field Block command instead of ^TB Text Block, despite the Zebra ZPLII guide advising against this.
Citizen support confirmed their printers do not support the ^TB command at the moment.

Related

ZEBRA ZT411 bad print size

I have a ZEBRA ZT411 label printer. I had a 203dpi printhead and changed it to 300dpi. I installed the ZT411 300dpi ZPL driver. The printer is now incorrectly calibrating the label. It doesn't push it to the edge so I can tear it off, but it's still tucked inside. It only prints on the bottom of the label. In size 40mm. The size of the label is larger. I've tried everything. Where is the mistake of how this could be changed?
I don't think that's an issue with the label because in that case, you would only have a smaller printout, but no calibration issues.
If you change the printhead with a different resolution, you also need to replace the pulley and the belt because the amount of paper the printer will push when you print a 203 dpi label and a 300 dpi label, is different.
Check here, page 2: you'll see the printhead part number (P1058930-013) which is the one you've used and the conversion kit (P1058930-022) which include the printhead, but also the mentioned pulley and belt, and that's the one you need.

How do I change the Zebra ZP 450 left position with OS X?

Please Help! I'm trying to print to a 1.5"x1.0" label on a Zebra ZP 450. The printer is connect to a Mac. When I print the label the printout is way over to the left. Only as small part of the bar code print out on the left side of the label. I'm guessing this is cause by the 'left position' in the printer settings. I tried calibrate (two flash and four flash) with no luck. I tried using zebrasetuputil app also with no luck (don't may not know enough of the programming to write it correctly).
Is there a terminal command I could use to change the default left position setting within the printer?
Sorry I'm new to all of this. Any help would be great!
OSX 10.11.1
Zebra ZP 450
Label Size: 1.5"x1.0"
Send this command to the printer:
^XA^LS0^XZ
^XA Starts the format (always required)
^LSa sets the offset where a = offset
^XZ End format (always required)
See the ZPL Programming Guide
Additionally, there is a command you can set to prevent other labels from setting these offsets. (Sorry, don't know off the top of my head) It's a very good idea because ideally these offset should only be used for printers that are exhibiting wear, and need an offset to account for physical differences.
Using it for label formats will cause all sorts of problems with label formats that don't set it, because the labels that do set it will cause the ones that don't to be offset.

Which should not be included in this ZPL Code?

I am developing a Windows Mobile App that requires printing into a Zebra printer. Problem is, I do not have the printer with me here in my country since the client did not provide any.
My approach was to design a label first in ZebraDesigner2, then print out the label into a text file. Printing the label to a text file instead of a printer sends out the ZPL Code to produce the label I was trying to print. Hence, I can generate ZPL codes faster by designing a label first then seeing the ZPL code. Kinda like having a drag and drop GUI with a background XML.
Say that I have this simple label that contains this text:
Hello World!
If I print this in ZebraDesigner2 it would be written to my text file as:
CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR5,5~SD15^JUS^LRN^CI0^XZ
^XA
^MMT
^PW609
^LL0406
^LS0
^FT1,29^A0N,28,28^FH\^FDHello World!^FS
^PQ1,0,1,Y^XZ
My main question is, which one do I include in my C# Code if im going to send this code to the printer via my Windows Mobile C# app? Do I include the part with ^XA until ^XZ? I believe that CT~~CD,~CC^~CT~ should not be included in my code If im not mistaken.
Late answer, but since this is getting viewed...
The CT line and first set of XA..XZ sequence sets up the modes, label length, printable area, etc.
If you remove those, it will take those settings from the label/printer settings, which is usually what you want. The printers can sense the length and width of the label.
Leaving them in can cause big problems, because if you define the printable area in your label, and then the next label type submitted does not, it will use the settings you have defined -- which can cause blank areas in the label, eg. cutoff USPS Label barcodes that are printed after your Zebra Designer custom labels.
Found this out the hard way - leave those out, and you should leave out of the remaining XA..XZ sequence the MMT, PW609, LL0406, and LS0 as well - your Hello World will not be affected.
If you really want to limit the area printed to, set up margins inside the printable area, etc, refer to the manual.
you have to look at the programmers guide before you remove anything of the code. The CT~ command for example changes the control prefix.
Search the internet or zebra.com site for "ZPL Programming guide".
So, leave the text file as is and then include that into your windows mobile application.
PS: zebra offers SDKs for label/receipt printers: http://www.zebra.com/gb/en/products-services/software/adapt-software.html
PS2: without a test printer you may get bad final results.

Printing a graphic to a Zebra LP2844 with the GW EPL command?

I need to print an image that is being returned to me through a web service (the data is returned as RAW) and I cannot for the life of me figure out how to print a graphic to a label with EPL.
The EPL manual defines the Graphic Write instruction as:
GWp1, p2, p3, p4, DATA
All of the parameters are returned to me, so I don't have to worry about calculating the height, width, etc., but my problem is that I don't know how to format the DATA.
The manual says DATA should be
Raw binary data without graphic file formatting. Data must be in bytes.
I've tried passing a binary string and a hex string, but nothing seems to work. There is no example on how to use this command in the EPL manual and after hours of searching online I have not been able to find a single example of how to use the command (i.e. example EPL commands that I can copy & paste to send to the printer).
Does anyone have an idea of how to use this command? Could you provide me with an example? (by example I don't mean a framework, code, etc., what I mean is just the plain EPL commands).
I can confirm that the data is in raw, uncompressed binary. It is also inverted-- that is, the 0 bits print as black, at least on my UPS-firmware LP-2844. I have no idea why all the examples from Zebra show the data as encoded into a hex representation.
It's worth noting that most print servers (HP Jetdirect, Lantronix LPS1-T, and almost certainly the Zebra built-in and external print servers) will form a binary connection to the printer if you spit data at them on port 9100 (using netcat for example):
nc printer_hostname_or_ip_address 9100 < test_file.txt
You get no feedback from the printer, except for the label having printed or not.
It takes my LP-2844 (UPS Firmware) printer about 5-6 seconds to print a label containing a 816 wide x 1218 tall downloaded bitmap onto a 4" wide x 6" tall label. It seems to be all imaging time: sending three labels at once is not any faster, and the network connection (through a Lantronix LPS1-T) is held open until the final label prints. That image is at the native resolution of the printer (203 dots/inch), and there is no dithering or resizing going on (I don't think EPL2 even knows how to dither or resize).
It might be possible to speed up the imaging time by optimizing the label into many smaller bitmaps (and horizontal and vertical line segments, and perhaps filled-in rectangular blocks). This wouldn't be a very hard optimization because the image is a single-bit black and white bitmap, and the code would be fairly simple. I don't know if it would really speed it up, though.
A more modern Zebra GX420 running ZPL with a built-in ethernet port ($500 online) can print the same label (with essentially the same graphic download encoding) in 1-2 seconds.
By the way, since I haven't yet actually answered the question, the raw EPL code for this is:
(a blank line)
N
q816
Q1218,20
GW10,10,102,1218,(124236 bytes of inverted bitmap data)
P
all the newlines are 0x0a (unix-style).
Maybe this will help, it has examples (and corrects an error in the manual). Also, it may be easier to use the GM command instead and just delete the image each time (see here for a stackexhange related question).
That being said, I've never gotten my Eltrons to successfully print an image (but my jobs don't require it).
Good luck!!
EDIT: Here's another link with example Perl code. They're aiming for Chinese characters but show how to print the Great Wave image (which oddly is Japanese).
I found that it is not possible to send a graphic to a Zebra printer with EPL using ASCII characters. The data must actually be sent as RAW data. So, for example, you can't send a graphic to the printer using Zebra Setup Utilities, or through any other means that cannot write RAW data from a file directly through the printer.
The only way around this I've found is to create the label as an image and send that image to the printer via a print command within your application.

How do you change the letter-spacing/tracking in core text?

This could probably also be asked as "Is kCTKernAttributeName a misnomer?"
I need to change the letter spacing/tracking of some text in iOS. (The font I'm using is a little too tight at small sizes.) There are core graphics routines that will change character spacing, but those routines don't handle Unicode. There are other core graphics routines that are defined in terms of glyphs but those seem like a world of hurt, among other things, not having the safety net of reverting back to system fonts for glyphs that don't exist in my font.
So core text seems like the way to do this and core text supports kCTKernAttributeName on CFAttributedString. I think this will do what I want, though this really isn't kerning since kerning is a generally a character-pair attribute and this (appears to be, from the docs) just a uniform adjustment to the glyph advance for all glyphs, i.e., tracking.
If anyone knows before I go down the rather painful path of converting to the core text API ...
kCTKernAttribute name should do what you want. Setting it over a range of text adjusts the inter-glyph spacing consistently, irrespective of the specific glyphs.
I think part of the problem is that kerning seems to have been a virtual synonym of tracking (it's still just "adjust the spacing between (letters or characters) in a piece of text to be printed" in the dictionary that comes with OS X), and is now adopting just the meaning of pair kerning because of the redundancy. Probably an etymologist would be better placed to comment on that side of things...

Resources