StampPDF Batch Variable Substitution Example

StampPDF Batch Variable Substitution Example

Here is a simple example of using StampPDF Batch to stamp a customer name on the bottom left corner of each page; and, stamp an account number on the top right corner of each page.

# Options
Begin_Options
Version (2)
TopMargin (0)
BottomMargin (0)
LeftMargin (0)
RightMargin (0)
End_Options

# — Stamp Item 1
Begin_Message
Name (Customer Name Item)
Type (Text)
PageIncrement (1)
StartPage (1)
EndPage (-1)
Font (MyriadPro-Regular)
Text (Customer: %First_Name% %Last_Name% )
Position (bottom)
Justification (left)
Underlay (no)
End_Message

# — Stamp Item 2
Begin_Message
Name (Customer Account Number Item)
Type (Text)
PageIncrement (1)
StartPage (1)
EndPage (-1)
Font (OCRA)
Text (Account# %Account_Number%)
Position (top)
Justification (right)
Underlay (no)
End_Message

Stamped Page with Customer Name and Account Number

The -vars parameter allows you to replace variables found within the stamp file, and thus substitute the text that it stamps based on parameters passed to StampPDF Batch.

stamppdfapp.exe -o JaneDoe.pdf 
    -vars "First_Name,Jane,Last_Name,Doe,Account_Number,B12345678" 
    StampFile.txt InputFile.pdf

If the text of an item contained in the stamp file contains one or more pairs of percent signs, the text between each pair of percent signs is the name of a variable to be replaced. In this case we are replacing the following three variables found in the stamp file:

First_Name Jane
Last_Name Doe
Account_Number B12345678

StampPDF Batch can then be called repeatedly with different substitution values for the given variables.