SIMPLE3 – add copies, barcode, watermark

Top  Previous  Next

 

This rule set adds copy handling, a watermark, and a barcode.  To produce this sample, use this command:

 

uf101c –i sample1.txt –f simple.rul –r simple3 –p pdf –o client:simple3.pdf

 

 

A title header prefixes all rule sets, which is just a unique name enclosed in brackets.

[simple3]

# to use this rule set, you need to FORCE the rule set with the -r option

# or remark (#) out the detect command in the rule sets above.

#

# This rule set takes the rule set above and improves it by adding

# copies, watermark, and a barcode.

 

dsn_sample "sample1.txt"

detect 61,5,"~../../..  ......."        # invoice date and #

detect 9,11,"~......"                   # customer code

detect 10,21,"~../../.. ......"         # ord date and cust code

 

cols 80                                 # max output columns

rows 66                                 # max output rows

 

This rule set produces two copies of each page, with each copy sequentially produced as each page is read from the data stream.  The pcopies command indicates this page-oriented copy production.  There is also a copies command, which produces job-oriented copies for laser jobs.  Note that PDF output always is produced as page-oriented copies, whether copies or pcopies is used.
 
When copies are produced, all rule set content that is not bracketed within 'if copy' blocks is produced on all copies.  The majority of this rule set is outside of such blocks, so the majority will be applied to both copies.  Near the bottom of the rule set is some code that will apply distinctly to each copy.

 

# copies

pcopies 2

 

# header section

cbox .5,.5,80.5,66.5,5

image 1,1,12,6,"sdsilogo.pcl"

text 1,2,"Company Name",univers,14,bold,center,cols=79

text 1,3,"Company Address\nCompany City, St Zipcode\nCompany Phone",univers,12,bold,center,cols=79

text 1,6,"Web: www.myweb.com\nEmail: sales@myweb.com",univers,11,bold,center,cols=79

text 1,2,"INVOICE",univers,16,bold,right,cols=79

 

# invoice # section

cbox 67,4,80.5,10,1,crows=6 8,ccols=74::20

text 68,5,"Date",univers,italic,10

text 68,7,"Invoice",univers,italic,10

text 68,9,"Page #",univers,italic,10

# cut data from old position and place in new

text 75,5,{cut(61,5,8,"")},cgtimes,bold,10

text 75,7,{cut(71,5,7,"")},cgtimes,bold,10

text 75,9,{cut(79,5,2,"")},cgtimes,bold,10

 

# bill to / ship to section

cbox .5,10,80.5,18.5,5,ccols=7::20 43.5 50::20

text 2,12,"Sold To",cgtimes,italic,10,center,cols=5

cfont 8,11,40,11,cgtimes,bold,10,left

cfont 8,12,40,15,cgtimes,bold,10                         # sold to address

text 45,12,"Ship To",cgtimes,italic,10,center,cols=5

cfont 51,11,80,11,cgtimes,bold,10,left

text 51,12,{mcut(51,12,30,4,"","Y","Y")},cgtimes,bold,10

 

# ribbon section

cbox .5,18.5,80.5,22.5,5,crows=20.5::20,ccols=9 18 25 65

# special internal grid in ribbon box

cbox 29,18.5,65,21.5

cbox 42,18.5,56,21.5

text 1,19,"Order\nNumber",univers,italic,10,center,cols=8

text 10,19,"Order\nDate",univers,italic,10,center,cols=8

text 19,19,"Cust.\nNumber",univers,italic,10,center,cols=6

text 26,19,"Sls\nPrs",univers,italic,10,center,cols=3

text 30,19,"Purchase\nOrder No.",univers,italic,10,center,cols=12

text 43,19,"\nShip Via",univers,italic,10,center,cols=13

text 57,19,"Ship\nDate",univers,italic,10,center,cols=8

text 66,19,"\nTerms",univers,italic,10,center,cols=14

 

cfont 1,21,8,21,cgtimes,bold,10,center      # order #

cfont 10,21,17,21,cgtimes,bold,10,center    # order date

cfont 19,21,24,21,cgtimes,bold,10,center    # cust #

cfont 26,21,28,21,cgtimes,bold,10,left      # sls prs code

cfont 26,22,64,22,cgtimes,bold,10,left      # sls prs name

cfont 30,21,41,21,cgtimes,bold,10,center    # po #

cfont 43,21,55,21,cgtimes,bold,10,center    # ship via

cfont 57,21,64,21,cgtimes,bold,10,center    # ship date

cfont 66,21,80,22,cgtimes,10,center         # terms

 

# detail section

cbox .5,22.5,80.5,56.5,5,crows=24.5::10,ccols=5 10 16 51 55 67

text 1,23,"Qty\nOrd",univers,italic,10,right,cols=4

text 6,23,"Qty\nShip",univers,italic,10,right,cols=4

text 11,23,"Qty\nBkord",univers,10,italic,right,cols=4

text 17,23,"\nItem & Description",univers,italic,10

text 52,23,"\nU/M",univers,italic,10,center,cols=3

text 56,23,"Unit\nPrice",univers,italic,10,right,cols=11

text 68,23,"Extended\nPrice",univers,italic,10,right,cols=12

 

cfont 1,25,4,56,cgtimes,10,bold,right        # qty ord

cfont 6,25,9,56,cgtimes,10,bold,right        # qty shipped

cfont 11,25,15,56,cgtimes,10,bold,right      # qty b/o

cfont 17,25,50,56,cgtimes,10,left            # item # & desc

cfont 52,25,54,56,cgtimes,10,bold,center     # u/m

cfont 56,25,66,56,cgtimes,10,bold,right      # unit price

cfont 68,25,79,56,cgtimes,10,bold,right      # extended

 

# memo section

font "    @1,25,4,56",17,0,60,1,cgtimes,10,left

 

 

This text line adds a large text watermark on line 56, centered horizontally.  The text is printed in cgtimes, 120 point, with 10% shading applied.

.

# watermark

text 1,56,"INVOICE",cgtimes,120,shade=10,center,cols=80,fit

 

# footer section

cbox 57,57,80.5,65,crows=59 63,ccols=67::20

text 58,58,"Sales Amt",univers,11

cfont 58,60,66,60,univers,11,left

text 58,61,"Sales Tax",univers,11

text 58,62,"Freight",univers,11

text 58,64.25,"TOTAL",univers,bold,14

cfont 68,58,79,65,cgtimes,bold,right,14                  # totals

 

The barcode command can be used to add barcodes in many symbologies.  It is similar to other commands, in that you provide a column, row, and value.  In addition, you specify a symbology (400 is Code 3 of 9), a point size or pixel height (14.0, being a decimal rather than integer value, is treated as  point size), and a bar spacing value in pixels.  Like most commands, you can use expressions in the value element of the command.  In this example, the data stream data from column 9, row 11, for 6 characters is used on each page, using the get() function within an expression.

 

text 2,58,"Customer code as 3 of 9 barcode",univers,italic,10

barcode 2,58.67,{get(9,11,6)},400,14.0,4

 

 

The following lines produce different output for each of the two copies.  Copy 1 is labeled with a text command to say it is the "Customer Copy", while copy 2 is labeled as "Accounting Copy".  Any commands outside of 'if copy' blocks are applied to all copies.

 

# copy name section

if copy 1

   text 1,65.5,"Customer Copy",univers,12,bold,center,cols=80

end if

if copy 2

   text 1,65.5,"Accounting Copy",univers,12,bold,center,cols=80

end if