CDS754

Zebra Label Printing

Last Revised: 12/15/17

This routine can be used to simplify printing to Zebra Label printers. It provides high level commands to print text, lines, boxes, and bar codes. The text font size is automatically scaled in order to fit the text into the width specified.

The Printer Type, as set in Printer Control Maintenance, must start with a "Z" to use this tool.

Printing Text
CALL "CDS754",Y6$,COL,ROW,HEI,WID,TEXT$ {,LCR$,MAXDOTS,ROT$}
Argument Description
Y6$ Printer Control from Printer Selection routine CDS084
COL Column to start printing.  Leftmost COL=0. There are typically 203 columns per inch, although this can vary with printer model.
ROW Top of Row where text will print. Topmost ROW=0.
HEI Text height in dots. 25 is a good starting value.
WID Width of a single character cell. 25 is a good starting value.
TEXT$

Text to be printed. Leading and trailing blank spaces are automatically trimmed by CDS754.

LCR$

Sets the text alignment

L Left justify (default if not passed)
C Center text over COL
R Right justify text (requires MAXDOTS)
MAXDOTS Maximum number of dots (cols or rows) that the text can use. CDS754 will automatically reduce the font size if the text takes more than this value. This prevents text from spilling over on top of other information that is printed on the label.
ROT$ Rotation Argument
NNormal orientation (default if not passed)
R90 degrees clockwise
I180 degrees clockwise (inverted)
B270 degrees clockwise (read from the bottom up)

 

Printing Vertical Line
CALL "CDS754::VLINE",Y6$,COL,ROW,HEIGHT {,THICK}
Argument Description
Y6$ Printer Control from Printer Selection routine CDS084
COL Column for upper left pixel of line
ROW Row for upper left pixel of line
HEIGHT Height of line in dots
THICK Line thickness in dots (defaults to 1 if not passed)

 

Printing Horizontal Line
CALL "CDS754::HLINE",Y6$,COL,ROW,LENGTH {,THICK}
Argument Description
Y6$ Printer Control from Printer Selection routine CDS084
COL Column for upper left pixel of line
ROW Row for upper left pixel of line
LENGTH Length of line in dots (defaults to 812-COL)
THICK Line thickness in dots (defaults to 1 if not passed)

 

Printing Box
CALL "CDS754::BOX",Y6$,COL,ROW,WIDTH,HEIGHT {,THICK,RND}
Argument Description
Y6$ Printer Control from Printer Selection routine CDS084
COL Column for upper left pixel of box
ROW Row for upper left pixel of box
WIDTH Width of box in dots
HEIGHT Height of box in dots
THICK Line thickness in dots (defaults to 1 if not passed)
RND Corner rounding parameter where 0 has no rounding and 8 is maximum rounding radius (defaults to 0 if not passed)

 

Printing Bar Code
CALL "CDS754::BARCODE",Y6$,COL,ROW,HEIGHT,VAL$,TYPE$,BARWIDTH,RATIO,TXT$,ROT$
Argument Description
Y6$ Printer Control from Printer Selection routine CDS084
COL Column for upper left pixel of bar code region
ROW Row for upper left pixel of bar code region
HEIGHT Height of bar code in dots
VAL$ The barcode value to be printed
TYPE$

Describes the type of bar code to be printed. Note that the less commonly used types may require additional arguments sent directly to the printer by the application program.

0 Aztec
1 Code 11
2 Interleaved 2 of 5
3 Code 3 of 9 (default if not passed)
4 Code 49
5 Planet Code
7 PDF417
8 EAN-8
9 UPC-E (9 digits)
A Code 93
B CODABLOCK
C Code 128
D UPS MaxiCode
E EAN-13 (13 digits)
F MicroPDF417
I Industrial 2 of 5
J Standard 2 of 5
K ANSI Codabar
L LOGMARS
M MSI
P Plessey
Q QR Code
R GS1 Databar
S UPC/EAN Extension
T TLC39
U UPC-A (12 digits)
X Data Matrix
BARWIDTH Width of narrow bar code line (defaults to 2 if not passed). The BARWIDTH and RATIO arguments apply to bar code types 1, 2, 3, I, J, K, L, M, and P.
RATIO Ratio of wide to narrow bar width. Defaults to 2 of not passed.
TXT$
N Do not print barcode text (default if not passed)
A Print barcode text above bar code
B Print barcode text below bar code
ROT$ Rotation Argument
NNormal orientation (default if not passed)
R90 degrees clockwise
I180 degrees clockwise (inverted)
B270 degrees clockwise (read from the bottom up)

Example

1000 PRINT_LABEL:
1010 LET COL=10,ROW=36,HEI=25,WID=25,MAXDOTS=210

1020 PRINT (Y6.CH)"^XA"; REM Start New Label

1030 PRINT (Y6.CH)"^PW230"; REM Set Label width

1040 CALL "CDS754::BOX",Y6$,0,18,225,157,1,2

1050 CALL "CDS754",Y6$,COL,ROW,HEI,WID,IM01.DESC1$,"C",MAXDOTS

1060 LET ROW=ROW+25

1070 CALL "CDS754",Y6$,COL,ROW,HEI,WID,IM01.DESC2$,"C",MAXDOTS

1080 LET ROW=ROW+25

1090 CALL "CDS754",Y6$,COL,ROW,HEI,WID,CVS(STR(PRICE:"$##,###.00"),1), "C",MAXDOTS

1100 LET ROW=ROW+25

1110 CALL "CDS754::BARCODE",Y6$,COL+7,ROW,BARCODE$,BCTYPE$

1120 LET ROW=ROW+40

1130 CALL "CDS754",Y6$,COL,ROW,20,WID,IM01.ITEMNO$,"C",MAXDOTS

1140 PRINT (Y6.CH)"^XZ"; REM Print Label

1150 RETURN

Example with rotated text

0010 REM "CDS754-TEST1 - 12/15/17 Rotated Text Example

0020 SETESC DT_ERR; SETERR DT_ERR

0030 GOSUB SETUP

0040 GOSUB PRINT

0050 CALL "CDS094",Y6$,"E"

0060 GOTO EOJ

 

1000 PRINT:

1010 LET HEI=25,WID=25,MAXCOLS=380,MAXROWS=180

1020 PRINT (Y6.CH)"^XA"

1030 PRINT (Y6.CH)"^PW400"; REM "Label Width

1040 CALL "CDS754::BOX",Y6$,10,20,MAXCOLS,MAXROWS,1,2

1050 CALL "CDS754",Y6$,10,40,HEI,WID,"Top Line","C",MAXCOLS

1060 CALL "CDS754",Y6$,350,50,HEI,WID,"Right Side","L",MAXROWS,"R"

1070 CALL "CDS754",Y6$,10,160,HEI,WID,"Upside Down","C",MAXCOLS,"I"

1080 CALL "CDS754",Y6$,20,60,HEI,WID,"Left Side","L",MAXROWS,"B"

1090 PRINT (Y6.CH)"^XZ"

1100 RETURN

 

1200 SETUP:

1210 CALL "CDS041","CDS084",S084$,"YP"

1220 S084.NAME$="LP12"

1230 S084.MODE$="E"

1240 CALL "CDS084",Y$,Y5$,0,S084$,0,Y6$

1250 RETURN

 

8000 DT_ERR:

8010 CALL "CDS063",STR(TCB(5+3*(ERR=127))),Y$,PGM(-2)

8020 IF Y.ERRSTS=0 THEN SETERR 0 ELSE IF Y.ERRSTS=2 RETURN

8030 RETRY

 

9000 EOJ:

9010 IF TCB(13) THEN EXIT

9020 RUN "CDS001"