Rotating lable for counting scale - zebra-printers

I am working on making a label for a zebra printer that connects to a counting scale, and when you hit print on the scale the label prints from the printer showing the count. I have been modifying a template that I found for the label and I need to rotate the barcode and text on the label 90 degrees and I am having some issues with this.
I have already tried using the commands such as ^FWR at several different points in the code, however this does not seem to work.
Here is my code for the label.
FK"AUTOFR"
FS"AUTOFR"
V00,20,N,""
A50,380,3,3,1,1,R,"COUNT"
B75,380,3,1,2,5,50,B,V00
PA1
FE
FI

Example of 90° rotated barcode and text.
^XA
^CFA,30
^FWr
^FX section with text
^FO400,100^FDTest Label^FS
^FX section with barcode 12345678
^BY5,2,170
^FO100,100^BC^FD12345678^FS
^XZ

Rotating a label in requires you to not only rotate each piece of text and barcodes, but it also requires you to adjust the placement of the text as it rotates around the "origin" point.
Your label now looks something like this in ZPL:
^XA
^CFA,30
^FWR
^FO75,330^FDCOUNT^FS
^FO75,380^BY3,1,2^BC,50^FD123456^FS
^XZ
If you rotate the same label properly, it comes out to:
^XA
^FWR
^CFA,30
^FO235,75^FDCOUNT^FS
^FO175,75^BY3,1,2^BC,50^FD123456^FS
^XZ
There is more detailed descriptions of the rotation and how it works in the ZPL Manual Field Interaction Appendix If your label is large and/or complicated, it might be easier to use a label design tool to do it rather than manually.

Related

ZPL script for label triple

I'm getting trouble printing some labels with a Zebra GK420t.
I have the next designer and how I need to print:
And the Zebra Designer Essentials generate the next ZPL script:
CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR3,3~SD23^JUS^LRN^CI0^XZ
^XA
^MMT
^PW192
^LL0823
^LS0
^FT109,754^A0B,28,28^FH\^FDTEXTHERE^FS
^FT109,482^A0B,28,28^FH\^FDTEXTHERE^FS
^FT109,211^A0B,28,28^FH\^FDTEXTHERE^FS
^PQ1,0,1,Y^XZ
but it only print the center text and it vertically.
What is wrong with my ZPL/design?
It is my first time with this kind of printer, so i'm very newbie and I need use Browser Print, using a Javascript Library, and all ok here. But when I printed it, everything is wrong:
Only print center text
It prints vertically
Text is cut
Thanks
What Mark said is correct, but what I want to add is that I've the feeling you created the label in zebradesigner using the landscape orientation and this explains the B parameter and also why the three text fields are vertically aligned instead of being horizontally aligned.
What you can do instead of trying to manually correct the ZPL code, is to generate a new label using zebradesigner, but setting the orientation to portrait and unselecting the "rotated" option.
Second thing is to configure the label layout in this way, just changing the dimension and the horizontal gap according to the labels you have.
This should generate a valid ZPL code.

ZPL Center image within a Graphic box

I have logos of various sizes. I am trying to center them on a label within a ^GB
Is this possible or is there another way of doing this?
Code I tried: ^FO10,295,2^GB585,90^GFA,{items.manufacturer_logo}^FS
The ^GB command is used to draw boxes, not to print graphic fields and the parameters you put after the GB command are the width (585) and height (90) of the box.
Regarding the graphic field (^GF), there isn't a parameter in this field you can use to align to the center the image, so you need to manually enter the coordinates to center the field in the ^FO command, but if you're working on a software which can dinamically calculate the position of the fields, you can maybe do it automatically.
When it comes to design a label in ZPL language, my advice is usually to use zebradesigner, create the label and then export it using the "print to file" option you can find in the print view.
You can download zebradesigner for free from here
https://www.zebra.com/gb/en/support-downloads/printer-software/zebra-designer-3-downloads.html

An easy way of setting a ZPL template as landscape rather than portrait?

Is there a simple way of setting an entire label to print in landscape orientation rather than portrait? I tried the FWR method but it doesn't seem to affect it at all.
I get the feeling i'm going to have to completely realign my fields and graphic boxes if i want to make it landscape.
^FWr command changes orientation of a field.
If you want to set whole label orientation, use ^POa instead, like described e.g. in Label Rotation and Orientation for ZPL based Desktop and Tabletop Printers document.
The ^PO command will only allow you to rotate in 180 degree increments, so that will not help you here.
Unfortunately, the answer to your question is "No." In order to switch between landscape and portrait modes, you will need to manually rotate/reposition/realign all your graphic boxes, text fields, and barcodes. (I feel your pain though, I've had to do this before and it is not fun.)

Get theme properties of Group Box lines

My goal is to draw a Group Box that is not rectangular but instead has the corners cut away. I do not mean just clipping the corners, but rather have a continuous closed path where the corners are "indented." I want this to match the colors/style of the current theme.
I noticed on Windows XP that the Group Box has 1-pixel gray lines, but on Windows 7 there is a 3D effect created by having a gray line next to a white line (the white line on the interior except on the bottom where it's below the gray line).
You can get the color of the text label of a Group Box using something like this:
COLORREF cref;
GetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref);
So, I'm trying to figure out how to get the color(s) and/or properties of the lines used in a Group Box, then (I hope to) be able to draw the lines I want matching the Group Box style by separately drawing each piece of the shape I want. I'm not sure what properties are used to describe the lines or if functions line DrawRect will draw the 3D effect with a suitable Pen. Is there a way to set a Pen to draw these 3D effects (2-shade parallel lines)?
Thanks.
The thing I always find unexpected about groupboxes is that they are really a style of buttons. (BS_GROUPBOX).
Themed groupboxes (XP and later with classic mode off) use theme part BP_GROUPBOX in VSCLASS_BUTTON. You can use the usual theme APIs to get and draw. If your Group box needs text you can use DrawThemeText.
There are APIs for drawing non-themed group boxes too (e.g. DrawEdge), but I don't remember the details and it's unlikely that you need them.
As usual, I will point out that reproducing the behaviour of controls is always harder than you think it is going to be.
Martyn

Printing Gray Lines with MFC/VS6

Does anybody know the "magic trick" for printing gray lines in an MFC/VS6 based application, using the PS_SOLID style?
It works when printing to PDF, but I just get black lines when printing to my black/white laser printer. It also works with the PS_INSIDEFRAME style, but it seems strange to me that a normal PS_SOLID can't do gray
Here's how the CPen is setup:
CPen linePen(PS_SOLID, 50, RGB(128,128,128));
I am using the MoveTo/LineTo functions for drawing.
Thanks!
Fabian
Are you sure the printer context is set correctly, i.e. that you don't have a bit depth of 1?

Resources