LABELS – text labels to laser labels |
Top Previous Next |
UnForm is capable reading rows of input, parsing those rows into logical pages, and reproducing the output with different dimensions. A typical situation that can take advantage of this is if your application is designed to print mailing labels on continuous label stock on dot matrix printers. The labels can be 1-up, 2-up, or any other dimensions. As long as each label has a consistent number of rows and columns, UnForm can parse each label and treat each label as a logical page with the across and down commands. To use this sample, you must add "-r labels" to the command line.
uf101c –i sample4.txt –f advanced.rul –r labels –p pdf –o client:labels.pdf
This statement header identifies the rule set. The name is used in the –r command line option.
[labels]
Each label "page" is 35 columns and 6 rows of input text. If each line is 106 to 140 characters wide, then four labels are parsed from the columns. When the output is produced, each label will be 30 columns by 6 rows. The labels will be arranged 3 rows across and 10 down the page. UnForm will actually print 3x30=90 columns and 10x6=60 rows on each physical page.
Most laser label stock has ½ inch top and bottom margins. The margin command adds 75 dots (¼ inch) to the standard UnForm top and bottom margins, which default to ¼ inch.
In this sample, the text of the labels is printed from lines 1 to 4. By using the vshift 1 command, UnForm will move the text to lines 2 through 5. The shift command moves the text to the right.
page 35,6 rows 6 cols 30 across 3 down 10 font 1,1,40,6,cgtimes,12 margin 0,0,75,75 vshift 1 shift 2 # manual feed tray is usually 2 # tray 2
The barcode command supports both 5 and 9-digit formats of the postnet barcode. To get either to print, the prepage code block sets one or the other variable (zip$ or zip9$), and both commands are issued. A null value is not barcoded. The prepage code extracts the zip code from line 3 or 4 of the label. It then determines the length and sets zip$ or zip9$ appropriately.
barcode 2,6,{zip$},900,11.0,2 barcode 2,6,{zip9$},905,11.0,2
prepage{ # get zip code from line 3 or 4 zip$="",zip9$="",zipline$="" if trim(text$[4])>"" then zipline$=trim(text$[4]) if zipline$="" then if trim(text$[3])>"" then zipline$=trim(text$[3]) while zipline$>"" x=mask(zipline$,"[0-9][0-9][0-9][0-9][0-9]") if x>0 zip$=zipline$(x) zipline$="" wend # remove possible hyphen and validate length x=pos("-"=zip$); if x=6 then zip$=zip$(1,5)+zip$(7) if len(zip$)<>5 and len(zip$)<>9 then zip$="" if len(zip$)=9 then zip9$=zip$,zip$="" } |