StampPDF Batch Users Guide
High Volume Stamping and Customization of PDF Files
Quick Reference
Usage: stamppdf [options] <stamp file> <pdfdoc1> [ <pdfdoc2>...]
-u <string> : Remove old stamps with UndoLabel (can be used more than once with different label)
-j <int> : Number of characters in Bates numbers (default 6)
-d <string> : Owner password to open this document
Save Options
-i : Save using an incremental save
-w : Linearize to support byte serving across the web. Forces full save
-optimize : Optimize the output file to try to reduce file size
-nocomp : Do not compress using Object Streams; compatible with all version of Acrobat
-comp : Compress using Object Streams; Acrobat 6 and later
-iso32000 : Set file for ISO 32000 compliance (PDF 1.7) -pdfa : Preserve PDF/A compatibility in a PDF/A compliant input file -o <file> : Save to a new output PDF file
-overwrite : Required when overwriting an input file
-arabicfixedlength : Do not increase the length of Arabic text
-sameversion : Use the same PDF version as the input PDF file
Command Line Variable Substitution
-vars : List of variables to be substituted in the Stamp File ( “name,value,name,value” )
-vardelimiter: Delimiter character for variables in the stamp file (Default is %)
Command Collections
-cmds <file> : Path to the command collections file
Watched Folders
-watch <file> : path to watched folder base directory
-watchin <file> : path to input watched folder; optional
-watchout <file> : path to output of watched folder; optional
Encryption Options
-encrypt : Encrypt output file
-keylength <int> : Key Length. Valid options are 40 and 128. Default is 128.
-ownerpass <string> : New Owner Password (Required)
-userpass <string> : New User Password
-noprint : Do Not Allow Printing
-nomodify : Do Not Allow Modifying the Document
-nocopy : Do Not Allow Copying text or graphics
-nonotes : Do Not Allow Adding or changing notes or form fields
-nofill : Do Not Allow Fill or Sign of Form Fields
-noaccess : Do Not Allow Accessibility
-noassembly : Do Not Allow Document Assembly
-nohighres : Do Not Allow High Resolution Printing
General Options
-listfonts : Display a list of the fonts available to StampPDF Batch
-listundo : List the undo labels present in a pdf file to stdout
-l <file> : Log to the file logFile
-p : Show progress information
-n : Do not write information to screen
-v : Version information
-help : Help information
-h : Help information
-r <string> : Product registration code
Introduction
Overview
StampPDF Batch® is a server-based command-line driven application that can stamp new text and/or images into PDF documents. Any text or image added by StampPDF Batch becomes a permanent part of the document. Refer to Introduction to the Command Line if you are not familiar with using command-line tools.
Stamps can be watermarks, page numbers, or headers and footers. With StampPDF Batch you can stamp “Confidential” on pages that include sensitive information, or “Draft” on a preliminary PDF document you distribute for review. Using variables, you can stamp PDF document names, revision numbers, or creation dates on PDF documents to help users quickly identify the documents. Law firms can apply Bates numbering across a document or entire set of documents.
StampPDF Batch provides the flexibility to customize the appearance and position of a stamp to comply with your organization’s corporate standards or to create a consistent look for PDF documents. You may specify any of the following features for a stamp:
- Text attributes such as font, style, size, and RGB or CMYK color
- Position — top, bottom, diagonal or vertical center
- Justification — left, right, or center
- Layer — on top of or underneath the original content of a page
- Pages to stamp — stamp every page, every other page, every 5th, 10th, etc.
- Page margins — position your stamp exactly where you want it
- Bates numbering — specialized page numbering for legal documents
In addition, you can mark a stamp so that you can remove it later.
The following sections are helpful for using this guide.
User Guide Conventions
This User Guide uses certain styles of text to indicate different things throughout the documentation. The following is a description of these styles:
- Command Line user input:
$stamppdfapp -r <Reg Number> -p -l <logfile.txt>
- Code snippets: begin_message
- Paragraphs that start with Note: are special notes relating to the subject. It is recommended that you read all notes.
- Paragraphs that start with ADVISORY: are recommendations or warnings.
StampPDF Batch Installation
Introduction
StampPDF Batch is a server-based, command-line-driven application that lets you stamp new text or images into PDF documents. Any text or image added by StampPDF Batch becomes a permanent part of the document.
Memory Requirements
Minimum free memory available to run the application: 512 MBytes.
Windows Installation
Windows installation is handled by the installer and does not require any special handling.
Unix Installation
Setting environmental variables (All Unix Platforms)
In version 5.1 and higher, there are two additional environmental variables that need to be set for StampPDF Batch on all UNIX platforms. If you run StampPDF Batch from the stamppdf script created during installation, these environmental variables will be set by the script. If you run stamppdfapp directly, you will need to set these environmental variables to run StampPDF Batch. Once StampPDF Batch is installed, you can view the variables needed by looking at the stamppdf script created by the installer.
Setting the Appligent home directory (All Unix Platforms)
The environmental variable that stores the location of the Appligent home directory is APPLIGENT_HOME. The default location for the Appligent home directory is /usr/local/appligent. The Appligent home directory contains the library files and resources needed to run StampPDF Batch. It also contains license information for StampPDF Batch.
Example:
export APPLIGENT_HOME=/usr/local/appligent
Setting the APDFL library path (All Unix except AIX)
The APDFL library path must be added to the LD_LIBRARY_PATH variable. The APDFL library path is located in a subdirectory of the APPLIGENT_HOME directory.
The path should be set to ${APPLIGENT_HOME}/APDFLX.X.X/Libs
Example:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${APPLIGENT_HOME}/APDFLX.X.X/Libs
Setting the APDFL library path ( AIX Only )
The APDFL library path for AIX must be added to the LIBPATH variable. The APDFL library path is located in a subdirectory of the APPLIGENT_HOME directory.
The path should be set to ${APPLIGENT_HOME}/APDFLX.X.X/Libs.
Example:
export LIBPATH=${LIBPATH}:${APPLIGENT_HOME}/APDFLX.X.X/Libs
Registration Numbers for StampPDF Batch 5.1 and higher
In previous versions of StampPDF Batch, the StampPDF Batch registration number was required as a command line option with the -r flag each time stamppdfapp was run. A stamppdf script was provided that automatically added -r and the registration number to the stamppdfapp command line when the script was run. In the current release, in addition to getting the registration number from the command line, StampPDF Batch can get the registration number from a license file in the appligent home directory. License files are created by the installation script and stored in the ${APPLIGENT_HOME}/license directory. With a valid license file, the -r is no longer required on the command line. The -r option can still be used as in previous versions, and will override the value in the license file.
Using Fonts
Base14, OpenType, TrueType, Type1 and Unicode (see Encoding) fonts are all supported in StampPDF Batch. In previous versions, Type1 fonts were used in StampPDF Batch by including the FontFile parameter. In StampPDF Batch 5.2.2 and higher, you should only specify the font name.
In order to use a non-Base14 font, the font must be stored in one of the Appligent font directories (See Font Directories below). You can run the command
$ stamppdf –listfonts
to see a list of all font names available for stamping. The font name should be used exactly as it is shown in the font list.
Some of the classic Base14 fonts are no longer included with the application resources. In particular Times and Helvetica. Both of these fonts are automatically substituted; but, may not appear identical to the classic fonts. If the new font appearance are not accept-able; simply use the versions of Times and Helvetica available on your system. This can be done by setting the Font Directories; please see below.
Font Directories
There are two font directories. The default font directory is found under the AppligentHome directory in APDFLX.X.X/Resource/Font.
Windows
The AppligentHome directory is in the AllUsers Application data directory.
Windows XP: C:\Documents and Settings\All Users\Application Data\Appligent
Windows Vista and later: C:\ProgramData\Appligent
Environment variables can be set on Windows under the System Properties. To display the System Properties, right click on “My Computer” and select properties. On the bottom of the Advanced tab, click the button labeled “Environment Variables”. Under system variables, you will see an entry for AP_FONT_DIR. Select this entry, and click edit. You can then change the
variable’s value to the path of the current font directory. Multiple directories can be added by placing a semicolon in between each directory path.
Unix
/usr/local/appligent
You can also specify an additional font directory, the AP font directory. The path to the AP font directory is saved in an environment variable called AP_FONT_DIR. You will be prompted to enter a font directory during installation.
As the other environment variables for StampPDF Batch, AP_FONT_DIR is set in the stamppdf script. The directory set in an environment variable in the script, or be set for the shell. See ManualInstall.pdf for more information on setting the AP_FONT_DIR and other environment variables on Unix.
General Command Line Options
Introduction to Command-Line Options
Command-line options are used in all Appligent Document Solutions server applications. The general options deal with product information, progress messages, and file maintenance. The following sections detail the use of these options.
General options
The following table provides a summary of the general command-line options:
Option | Parameter | Description |
---|---|---|
-r | <RegNum> | Pass registration number to StampPDF Batch |
-l | <logFile> | Write progress information to logfile |
-p | Provide progress messages | |
-n | Do not write anything to screen | |
-v | Display version information | |
-h or -help | Display usage information | |
-o | <outFile.pdf> | Save output to a new file or directory |
-overwrite | Save the output to the input PDF file | |
-d | <string> | Owner password to open this document |
-w | Linearize the file upon save | |
-i | Perform incremental save | |
-optimize | Optimize the output file to try to reduce file size | |
-nocomp | Do not compress using Object Streams (resulting file is compatible with all versions of Acrobat) | |
-comp | Compress using Object Streams (resulting file requires Acrobat 6 and later) | |
-iso32000 | Set file for ISO 32000 compliance (PDF 1.7) | |
-listfonts | Print a list of available fonts in the appligent_home fonts folder | |
-listundo | Print a list of undo labels in a the document |
General options detailed
The following sections provide details on using the general command-line options.
-r <RegNum> — Pass registration number to StampPDF Batch
This option can be used to supply your registration number to StampPDF Batch from a script or another application:
$stamppdfapp -r XXXX-XXXX-XXXX-XXXX-XXXX-XXXX [other options]
This option is typically not necessary and is available for use in cases where the Appligent License File can not be located by the application because of runtime environment restrictions.
-l <logfile> — Log to a log file (optional)
Write to a text file any errors and progress messages. A log file is created only when errors are present. This option is helpful for debugging. The -l <logfile> option must be followed by a file name. Your log file will look different if you are also using the -p option.
Note: If the log file you specify is a read-only file, a warning is displayed and nothing is written to the log file. Make sure that your log file is write-enabled.
-p — Show progress (optional)
Write progress messages to the screen STDOUT, the standard output of your system. This option is helpful for debugging and for understanding how StampPDF Batch works.
A note on using -p and -l <logfile> together
As outlined in the above sections the -p option gives you progress messages on your screen and the -l <logfile> option writes error messages to a file if errors occur. The table below provides more detail on using these options alone or together.
-l | -p | errors found | Result |
---|---|---|---|
Nothing will be written to the screen or to the log file you specify | |||
Progress message will be written to the screen and stamppdf.log | |||
Progress messages will be written to the screen and to the log file you specify | |||
A stamppdf.log file will be created with the errors in your working directory | |||
Errors will be written to the log file you specify | |||
Errors will be written to stamppdf.log and your screen | |||
Both progress and error messages will be written to the screen and to the log file you specify |
Therefore, -l <logfile> used on its own will only go into action if there are errors. With -p and -l <logfile> combined, you will get a text file with full details on StampPDF Batch operations whether there are errors or not.
-n — Do not write anything to screen (optional)
Do not write anything to the screen (or STDOUT). If you are running batch mode, this prevents progress messages from building up.
-v — Print version information (optional)
Display the version of StampPDF Batch you are running. This is important when corresponding with us via support@appligent.com. In order to best understand your problem, we must know what version of the software you have. StampPDF Batch will not do anything else if you use this option.
-h or -help — Show usage (optional)
Display all available command-line options. StampPDF Batch will not do anything else if you use either of these options.
-o <outFile.pdf> — Save to a new file or directory (required)
When processing one input file, specify an output file for the results. If you are processing more than one input file at a time, specify an existing directory for the resulting files. When you stamp several files at one time and use the -o option, make sure to specify the name of an existing directory.
ADVISORY: We recommend that you always specify a new output file name so that your original file will remain unchanged.
-overwrite — Save the output to the input PDF file (optional)
This flag will allow you to overwrite the input PDF file you are stamping. You do not specify a file name after -overwrite on the command line. Example: stamppdf -overwrite Stamp.txt Input.pdf
-d <string> — Owner password to open the document (optional)
If the PDF document you wish to stamp has been encrypted, you must pass the owner password with the -d <string> option in order to stamp the file. If you are processing more than one input file at a time, the owner password must be the same for all files.
-w — Linearize the file upon save (optional)
Save the output file as a linearized document. Linearization reorganizes the file to make it more efficient for web delivery. Individual pages can be rendered before the entire document has downloaded, so the user can start reading the document sooner.
-i — Perform incremental save (optional)
An incremental save appends changed information to the end of the file. This is faster than a full save, but may result in a larger file. A full save is similar to using the “Save As…” command in Adobe Acrobat. It is a save that attempts to clean up a PDF file, often reducing its size.
Note: There are four new options available in StampPDF Batch 5.x and later.
-optimize — Optimize the file (optional)
This flag will do the following: 1) encode any non-encoded streams using Flate compression, 2) remove ASCII85 filters from all streams, 3) replace LZW encoded streams with Flate encoding, 4) merge identical XObjects and images, 5) optimize common sequences in page content, and 6) merge identical font descriptors and encodings. This option will usually result in a smaller file size.
-nocomp — Do not compress using Object Streams (optional)
This flag will not compress Object Streams, resulting in a document that is compatible with all versions of Acrobat.
-comp — Compress using Object Streams (optional)
This flag will compress Object Streams, resulting in a document that is compatible with Acrobat 6.0 and later.
-iso32000 — Set file for ISO 32000-1 compliance (optional)
This flag sets the file for compliance with ISO 32000-1:2008 (PDF 1.7).
-listfonts — Print a list of available fonts in the appligent_home fonts folder
This flag lists all the fonts that are available to stamp using StampPDF Batch. StampPDF Batch version 5.2 now supports OpenType and TrueType fonts in addition to Postscript Type 1 fonts.
Below is a small example of some of the fonts that are shipped with StampPDF Batch. You will see these when you run -listfonts:
AdobeFanHeitiStd-Bold
AdobeGothicStd-Bold
AdobeHebrew-Bold
AdobeHebrew-BoldItalic
AdobeHebrew-Italic
AdobeHebrew-Regular
AdobeHeitiStd-Regular
AdobeMingStd-Light
AdobeMyungjoStd-Medium
AdobePiStd
AdobeSongStd-Light
AdobeThai-Bold
AdobeThai-BoldItalic
AdobeThai-Italic
AdobeThai-Regular
CourierStd
CourierStd-Bold
CourierStd-BoldOblique
CourierStd-Oblique
Dingbats
KozGoPr6N-Medium
KozMinPr6N-Regular
MinionPro-Regular
MyriadPro-Regular
Symbol
There are two font directories.
The default font directory is found under the AppligentHome directory in APDFLX.X.XResource/Font. On Windows, the AppligentHome directory is in the AllUsers Application data directory.
Windows 7 and later: C:\ProgramData\Appligent
Unix: /usr/local/appligent
You can also specify an additional font directory, the AP font directory. The path to the AP font directory is saved in an environment variable called AP_FONT_DIR. You will be prompted to enter a font directory during installation. The fonts that are in the AP_FONT_DIR will also show in addition to the fonts that are shipped with StampPDF Batch when you run -listfonts.
On Windows: Environment variables can be set on Windows under the System Properties. To display the System Properties, right click on “My Computer” and select properties. On the bottom of the Advanced tab, click the button labeled “Environment Variables”. Under system variables, you will see an entry for AP_FONT_DIR. Select this entry, and click edit. You can then change the
variable’s value to the path of the current font directory.
On Unix: As the other environment variables for StampPDF Batch, AP_FONT_DIR is set in the stamppdf script. The directory set in an environment variable in the script, or be set for the shell.
-listundo — Print a list of undo labels in the document
This flag lists all the undo labels that are set in the stamp file and can help when trying to remove a stamp with the -u flag.
Stamp Files
We will be using the sample stamp file letterstamp.txt in the samples directory as an example throughout this chapter. The default location for StampPDF Batch on Windows is C:\Appligent\StampBatch\. On other platforms, it will be wherever you installed it.
What is a Stamp File?
A stamp file is a text file that specifies how StampPDF Batch will apply stamps to your document. A stamp file has two main components:
- an options block placed at the beginning of the stamp file, containing the version of the stamp file, and specifies general stamp properties. Each line in the options block describes properties for the entire PDF document being stamped.
- one or more stamp items that contain the parameters to describe a particular stamp. Each stamp has its own stamp item and a stamp file can have an unlimited number of stamp items.
Options block overview
The options block specifies properties for the entire file. It consists of the following sections:
- Label — specifies the version of the stamp file.
- Positioning — specifies the default stamp margins for the entire PDF file.
- Acrobat options — specifies how Acrobat handles the document when opened.
Stamp items
Each stamp file can specify many stamps. The parameters for an individual stamp are contained in a stamp item. StampPDF Batch supports these types of stamps:
- Text stamps — Specify the text to stamp onto the document
- Unicode text stamps — Unicode text to stamp onto the document; for example, Chinese, Japanese or Korean text
- Image stamps — JPEG or TIFF image to stamp onto the document
- PDF stamps — PDF files stamped into the document
- Barcode stamps — Currently supports a variety of 1D and 2D barcodes
- PageTransform — Scale and Transform the page contents
All types of stamps use pagination, positioning and general parameters. Other parameters are unique to each type of stamp. Stamp items begin with the keyword Begin_Message and end with the keyword End_Message. In the following sections we will explain all the stamp item parameters, create stamp items for text stamps and create stamp items for image stamps.
Parameters
Each stamp item is described by a parameter/value pair. There must be at least one space in between Parameter (value). Enter parameters as follows:
Parameter (value)
For example:
Position (Top)
stamps the item on the top of the page.
Comments
You can insert comments where you need them to make the file more readable, or you can comment out sections for debugging purposes. Comments start with the hash or number symbol (#) which must be placed at the beginning of a line:
# This is a correct comment
Below is an incorrect comment:
Begin_Message #beginning of the file list
Stamp Files – Creating the Stamp File’s Options Block
Introduction
The options block specifies properties for the entire file. It consists of three sections: Label, Positioning, and Viewer Options.
Options block
Type | Parameter | Required | Default | Content |
---|---|---|---|---|
Begin | Begin_Options | Beginning of option block | ||
Label | Version | Version of stamp file: 2 | ||
Positioning | TopMargin | 12 | Top margin of page in points | |
BottomMargin | 12 | Bottom margin of page in points | ||
LeftMargin | 8 | Left margin of page in points | ||
RightMargin | 8 | Right margin of page in points | ||
Viewer Options | ViewMode | Unchanged | Zoom level the file should open in | |
OpenMode | Unchanged | Navigation mode the file should open in | ||
End | End_Options | End of option block |
Options block parameters — detailed description
The options block begins with the Begin_Options and ends with the End_Options keywords. Each stamp file has only one options block. For example, the options block in letterstamp.txt looks like this:
Begin_Options | Begin Options block |
Version (2) | Stamp file format version 2 |
TopMargin (36) | Top margin 36 points (1/2 inch) |
BottomMargin (36) | Bottom margin 36 points (1/2 inch) |
LeftMargin (36) | Left margin 36 points (1/2 inch) |
RightMargin (36) | Right margin 36 points (1/2 inch) |
ViewMode (FitPage) | Open Document to see entire page |
OpenMode (ShowNone) | Do not show navigation pane |
End_Options | End Options block |
Label parameter
Provides labeling information for the stamp file.
Version (required)
The stamp file format version. The Version parameter must be in the options block for the software to work. This version of StampPDF Batch uses version 2.
Positioning parameters
Specifies the default page boundary margins of the file, the area where stamping can occur. See Page boundary margins vs. stamp margins below for more information on how these margins affect stamp placement.
TopMargin (optional)
The amount of space, in points, from the top of the document to the stamping area.
Default value: 12 points.
BottomMargin (optional)
The amount of space, in points, from the bottom of the document to the stamping area.
Default value: 12 points.
LeftMargin (optional)
The amount of space, in points, from the left side of the document to the stamping area.
Default value: 8 points
RightMargin (optional)
The amount of space in points from the right side of the document to the stamping area.
Default value: 8 points.
Page boundary margins vs. stamp margins
When you specify the positioning parameters for a stamp item, you will override the page boundary margins defined in the options block for that stamp item.
In the figure below, the margins are 36 points, one half inch. The centered, diagonal stamp is centered between all four margins. The top stamp begins at the left margin and the bottom stamp ends at the right margin. Margins in the options block differ from rectangle margins for a stamp item. See Positioning parameters above for more information.
Converting inches to points
Margins are specified in points. One inch is equivalent to 72 points. The table below can help with conversions:
Inches | Points |
---|---|
0.11 | 8 |
0.167 | 12 |
0.5 | 36 |
0.75 | 54 |
1.0 | 72 |
1.5 | 108 |
2.0 | 144 |
An 8 1/2 x 11 inch page is 612 x 792 points.
Viewer option parameters
Specifies the default view and navigation modes for the file.
ViewMode (optional)
The default document zoom level. Possible values are:
- ActualSize
- FitHeight, full page height fits into the document window
- FitPage, full page fits into the document window
- FitVisible, visible page area fits into the document window
- FitWidth, full page width fits into the document window
If the ViewMode is not specified, the document retains its original setting.
OpenMode (optional)
The default navigation mode. Possible values are:
- ShowBookMarks, file bookmarks are displayed in the navigation pane
- ShowThumbNails, page thumbnails are displayed in the navigation pane
- ShowNone, the navigation pane is not displayed
If OpenMode is not specified, the document retains its original setting.
Creating Stamp Items for Text Stamps
Introduction
A stamp item begins with the Begin_Message and ends with the End_Message keywords. Each stamp file can have many stamp items. Each text stamp item uses various parameters for the text item. Each parameter will be described in detail below.
The table below summarizes all the parameters available for stamp items.
Type | Parameter | Text | Image | Default | Comments |
---|---|---|---|---|---|
Begin | Begin_Message |
|
Start of stamp item | ||
Label | Name | Name for stamp | |||
UndoLabel | Permits the later removal of a stamp | ||||
Type | Required: Stamp Type; Text, UTF8, UTF16, Barcode, Image or PDF | ||||
Pagination | StartPage | 1 | Start page for stamp | ||
EndPage | -1 | End page for stamp | |||
PageIncrement | 1 | How many pages to skip between stamps | |||
PageRange | all | Which individual pages to stamp | |||
Positioning | Top, Right | From options block | Margins for stamp. Overrides margins of the page boundaries set in the options block for the stamp item. | ||
Bottom, Left | |||||
Position | Top | Position and orientation on page | |||
Justification | Center | Left, right or center | |||
Angle | 0 | Angle to rotate text stamp | |||
Underlay | No | Above (no) or beneath (yes) existing text/images | |||
PageBox | Cropbox | Sets which set of page boundaries are used to position the stamp | |||
OffsetX | Horizontal placement offset | ||||
OffsetY | Vertical placement offset | ||||
Text Options | Size | 12 | Font size in points | ||
Font | Helvetica-Bold | Name of font | |||
FontFile | Location of font file, if necessary | ||||
TextMode | 0 | Mode: solid (0), outline (1) or invisible (2) | |||
Text | Text to stamp | ||||
WordWrap | No | Insert line breaks to fit text within margins | |||
CharSpace, WordSpace | 0 | Change spacing between characters and words | |||
LineSpace | 1 | Change spacing between lines | |||
ColorSpace | DeviceGray | DeviceGray, DeviceRGB or Device CMYK | |||
Gray | 0 | DeviceGray: Gray level (0–100) | |||
Red,Green,Blue | 0,0,0, | DeviceRGB: RGB color values (0–255) | |||
Cyan,Magenta,Yellow,Black | 1,1,1,1 | DeviceCMYK: CMYK color values (0–1) | |||
BatesDigit | 0 | Number of digits in Bates number | |||
Opacity | 1 | Transparency of text; 0–1 | |||
LinkURL | Specify URL link to be placed over the stamped text | ||||
AutoScale | Scale stamp to fit on a page regardless of page size | ||||
Image Options | Path | Location of image file | |||
Scale | Specify size of image | ||||
PageNumber | The page of a PDF to be stamped, only Type (PDF) | ||||
End | End_Message | End of stamp |
Stamp parameters — detailed description
A stamp item begins with the Begin_Message and ends with the End_Message keywords. Each stamp file can have many stamp items. Each parameter will be described in detail below.
Label parameters
Name (optional)
Name identifies the stamp item. The Name parameter will help you keep track of many stamp items in one stamp file.
UndoLabel (optional)
UndoLabel allows you to remove the stamp later. UndoLabel can be any character string, such as:
UndoLabel (undostamp)
Avoid using the characters \ / : * ? ” < > | ^ and &. These characters cause problems when used on the command line. The UndoLabel is case sensitive.
A stamp created with an UndoLabel can be removed via the command line using the -u option. Using the command line and command line options are covered in Using StampPDF Batch. The command for undoing a stamp is:
stamppdf -u undostamp Sample1.pdf
After running this command, any stamp that has the UndoLabel of “undostamp” in its stamp item will be removed from the document. Many stamps can have the same UndoLabel in their stamp item; they will all be removed at the same time. For example, if you would like to have all stamps removed with one command, use the same UndoLabel for all of them.
If a stamp item does not have an UndoLabel specified in the stamp file, you will not be able to remove it later. So if you are not sure, it’s always good to specify an UndoLabel and keep a record.
Note: Remember the name of your UndoLabel. There is nothing in the stamped document to indicate the name of a stamp item’s undo label. If you forget the undo label, and do not have the original stamp file to look it up, using the -u option is not possible. Also remember that undo labels are case sensitive. If you save the document from Acrobat using the “Save As” command, the undo labels will be lost.
Type (required)
The type of stamp you will be making. Text stamps can be plain text or Unicode. Image stamps can be JPEG, TIFF or PDF. Specify Barcode to stamp barcodes.
Specify the type of stamp using the following:
- Type (Text) for stamping plain text into your document
- Type (UTF8) for stamping UTF-8 Unicode characters into your document
- Type (UTF16) for stamping UTF-16 Unicode characters into your document
- Type (Barcode) for stamping code 128 barcodes
- Type (Image) for stamping JPEG or TIFF images onto your documents
- Type (PDF) for stamping PDF images onto your documents
For more information about Unicode stamps, see Using Unicode. For more information on stamping images or PDF files, see Creating Stamp Items for Image Stamps. For more information on stamping barcodes, see Stamping Barcodes.
Pagination parameters
StartPage (optional)
StartPage specifies the first page to be stamped. Enter any page number or use -1 which is a shorthand notation for the last page. If you would like stamping to begin on the second page, enter 2 for StartPage. If you would like stamping to begin on the fifth page, enter 5 for StartPage. StartPage is optional; if StartPage is omitted, stamping will begin on page 1.
EndPage (optional)
EndPage specifies the last page to be stamped. For example, if you have a stamp that you need applied only to pages 2 through 10, use StartPage (2) and EndPage (10).
If you wish to stamp to the end of the document, then EndPage can be set to (-1). The (-1) is a notation for the last page of the document.
EndPage is optional; if EndPage is omitted, stamping will continue to the end of the file.
PageIncrement (optional)
PageIncrement specifies the increment to place stamps, i.e., on every other page, every fifth page, every tenth page, etc. For example, a PageIncrement of…
- 1 stamps every page
- 2 stamps every other page
- 5 stamps every fifth page
Page increments begin with the StartPage you specified. You can coordinate these parameters to stamp even pages, odd pages, or other increments of pages that you choose.
PageIncrement is optional; if PageIncrement is omitted, every page between StartPage and EndPage will be stamped.
The following table shows how the StartPage and PageIncrement parameters can be used together for stamping selected pages in a document:
StartPage | PageIncrement | stamps pages |
---|---|---|
1 | 1 | 1,2,3,4,5,etc. |
1 | 2 | 1,3,5,7,9,etc. |
2 | 2 | 2,4,6,8,10,etc. |
1 | 5 | 1,6,11,16,21,etc. |
5 | 5 | 5,10,15,20,25,etc. |
You can apply different stamps on alternating pages, for example, to have the footer on even pages to be left-aligned, and on odd pages, right-aligned. You need two separate stamp items to achieve this: one with the left-aligned formatting and one with the right-aligned formatting. See the example below.
PageRange (optional)
PageRange lets you specify individual pages to stamp. PageRange overrides any range specified by StartPage, EndPage, and PageIncrement. To specify individual pages to stamp, list them separated by commas:
PageRange (1,3,6,8)
will stamp pages 1, 3, 6 and 8.
Note: If PageRange, StartPage, EndPage and PageIncrement are omitted, every page will be stamped.
Positioning parameters
Position (optional)
Position specifies where on the page the stamp item will appear. Position is optional. If Position is omitted, the stamp will be applied to the top. The figure below illustrates how various positions for stamps appear on pages. Allowed values are:
- Top, stamps text horizontally across the top of the page
- Diag-BottomLeft, stamps text diagonally, corner to corner, across the page beginning at the bottom left corner margin
- Diag-TopLeft, stamps text diagonally, corner to corner, across the page beginning at the top left corner margin
- BottomUp-Left, draw text up from the bottom, on the left edge of the page
- BottomUp-Right, draw text up from the bottom, on the right edge of the page
- TopDown-Left, draw text down from the top, on the left edge of the page
- TopDown-Right, draw text down from the top, on the right edge of the page
- Bottom, stamps text horizontally across the bottom of the page
- VCenter, stamps text at the precise vertical center of the document, as defined by the margin settings. Horizontal positioning must still be defined by other parameters
- Angle, used with the Angle parameter described below, which will stamp text at any angle. Position must be set to Angle for the Angle parameter to work.
Justification (optional)
Justification specifies text alignment on document pages. Justification is optional. If Justification is omitted, the text will be centered. The figure below illustrates how stamps display on pages using various values. Possible values are:
- Left, aligns text with the left margin of the document.
- Right, aligns text with the right margin of the document.
- Center, horizontally centers text between the left and right margins. Diagonal text stamps that use centering will also be centered vertically in the space between the top and bottom margins.
Use this parameter with Position, described above, to create accurate placement of your stamp.
Angle (optional)
Angle specifies an angle for stamp positioning, in degrees. Angle is optional. If Angle is omitted, text will be stamped horizontally. While a diagonal stamp will angle text on the page diagonal, the Angle parameter can position a text stamp at any angle. In order for the Angle parameter to be read, the Position parameter described above must be set to Angle.
The pivot point for an angle is defined by the Bottom and Left parameters. Justification for Angle is always Left. Any other value set for Justification will be ignored. Angle takes as its input any positive or negative number.
Underlay (optional)
Underlay specifies whether to stamp under, or on top of, existing text and graphics of the input PDF document. The figure below illustrates how stamps will appear on pages. Underlay is optional. If Underlay is omitted, text will be stamped over existing text and graphics. The options are:
- Yes, stamps text underneath the PDF document text and graphics.
- No, stamps text on top of the PDF document text and graphics.
Notes on using the Underlay option
Set Underlay to Yes to prevent covering the original PDF content. Other options for not obscuring original text are outline text, TextMode (1) or transparent text, Opacity (0.5).
- If the color of the text you stamp is the same color as the text in the document, your stamp will obscure the document text. To avoid this, specify gray or a different color to make the stamp stand out from the overlaid text.
- Underlaid text stamped on PDF documents that are scanned as image files will not be visible. For these types of documents use an overlaid stamp, set Underlay to No.
- Some PDF files contain hidden text and images. Underlaid text will not be visible under hidden images. If you encounter this, overlay the stamped text, and use outline text, TextMode (1) or transparent text, Opacity (0.5).
- Under some circumstances, the combination of the printer driver and the application used to create the PDF document will create a white rectangle behind the PDF text. An underlying stamp will be hidden by the body of the PDF text and images. If you encounter this situation, create an overlay text stamp, and use outline text, TextMode (1) or transparent text, Opacity (0.5).
Top, Bottom, Left, and Right Margins (optional)
Top, Bottom, Left and Right parameters specify the margins used for the stamp item that override the page boundary margins set in the options block. These parameters define a rectangle in which to place a stamp. The Position and Justification parameters work relative to this new rectangle, rather than the margins set in the options block for that stamp item. See the figures below:
|
|
If you do not want to modify all of the margins, only set the ones you want changed. If you leave out one of the parameters, that margin remains as set in the options block.
Note: Setting rectangle margins using Top, Bottom, Left, and Right differs from setting margins in the options block. In the options block, margins are set as the amount of space from the page edge to the margin. In the rectangles specified within a stamp item, all measurements are made from the lower left corner of the page.
Top, Bottom, Left and Right are optional; if any are omitted, the corresponding value from the options block will define the margin.
PageBox (optional)
This parameter sets which set of page boundaries are used to position the stamp. The options available for the PageBox parameter are mediabox, cropbox, artbox, trimbox and bleedbox. If the document you are stamping is cropped, set the PageBox parameter to cropbox.
Default value: cropbox
OffsetX (optional)
The OffsetX parameter allows you to specify a precise horizontal offset for a stamp item. The value of the offset is given in points, and can be positive or negative. A positive value of OffsetX will move the stamp to the right; a negative value will move the stamp to the left.
If you have a left-justified stamp with OffsetX set to 36 and LeftMargin set to 60, the image would be stamped 96 points from the left edge of the document: 60 points for the LeftMargin plus 36 points for the X offset.
OffsetX (36)
If you have a left-justified stamp with OffsetX set to -36 and LeftMargin set to 60, the image would be stamped 24 points from the left edge of the document: 60 points for the LeftMargin plus -36 points for the X offset.
OffsetX (-36)
OffsetY (optional)
The OffsetY parameter allows you to specify a precise vertical offset for a stamp item. The value of the offset is given in points and can be positive or negative. A positive value of OffsetY will move the stamp up; a negative value will move the stamp down. If you have a bottom-positioned stamp with OffsetY set to 20 and BottomMargin set to 72, the image would be stamped 92 points from the bottom edge of the document: 72 points for the BottomMargin plus 20 points for the Y offset.
OffsetY (20)
If you have a bottom-positioned stamp with OffsetY set to -20 and BottomMargin set to 72, the image would be stamped 52 points from the bottom edge of the document: 72 points for the BottomMargin plus -20 points for the Y offset.
OffsetY (-20)
Using a combination of OffsetX and OffsetY with Position and Justification parameters lets you place text and images very precisely in the document. See the figure below for examples of using these parameters.
As an example, a text stamp can be placed with a negative number of points to the left of the right margin of the stamp item when Justification has been set to Right. See Position (optional) and Justification (optional) for more detailed information.
#Options | Comment – Beginning of Stamp file |
Begin_Options | Begin Options |
Version (2) | Version Number |
TopMargin (0) | Page – Top Margin |
BottomMargin (0) | Page – Bottom Margin |
LeftMargin (0) | Page – Left Margin |
RightMargin (0) | Page – Right Margin |
End_Options | End Options |
# — Stamp Item — | Comment |
Begin_Message | Begin Stamp Item |
Name (Top Left) | Named Top Left |
PageIncrement (1) | Stamp every page |
StartPage (1) | Start on first page |
EndPage (-1) | Stamp to the last page |
Type (Image) | Image stamp |
Path (./appligent_logo.jpg) | Path to image to be stamped |
Position (top) | Position stamp at top |
Justification (left) | Left justify |
Underlay (no) | Place it over existing text and graphics |
OffsetX (36) | X axis Offset |
OffsetY (-36) | Y axis Offset |
End_Message | End stamp item |
The figure below shows the upper left hand corner of a file stamped with the stamp item parameters from the figure above. The page margins are all set to 0; without the offsets, both the text and image would be placed on the top-left edge of the page.
Text Options parameters
Size (optional)
Size specifies the point size of the font that you are stamping. Fractional point sizes are allowed, for example, 11.5. Size is optional. If you omit this option, text will be stamped 12 points. To help decide on a point size for your text stamp, most text you read is 10 or 12 points. Newspaper text, for example, is usually 10 points. Business letters are commonly done in 12 points.
To create a watermark that fills a whole letter-sized page diagonally, select a large point size: “Confidential” stamped in 128 points fills an 8 1/2 x11 inch page diagonally.
Font (optional)
Font specifies the name of the font to use. Font is optional. If Font is omitted, stamping will be done in Helvetica Bold.
There are four types of fonts StampPDF Batch can use:
- OpenType fonts
- TrueType fonts
- Postscript Type 1 fonts
- One of the PDF base 14 fonts
Metrics for the base 14 fonts are included with StampPDF Batch. The names of the base 14 fonts are:
• Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique
• Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique
• Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic
• Symbol
• Zapf Dingbats
Use the –listfonts command to see a list of all font names available for stamping. The font name should be used exactly as it is shown in the font list.
Note: Information on working with fonts, special characters and Chinese, Japanese and Korean languages; please see the “Using Unicode” section of this document.
FontFile (deprecated)
The FontFile parameter has been deprecated. To use a non-base14 font with StampPDF Batch, add the font to one of the font directories and specify the font name in the Stamp Item FontName ( ) parameter as specified in Using Fonts. Any FontFile parameter entries will be ignored. If you are currently using the FontFile parameter in any of your stamp files, check that the font name being used in the stamp item is correct. Previous versions of StampPDF Batch would allow the specified font file to override the FontName; currently the FontName has priority.
Notes on fonts
StampPDF Batch also supports the use of barcode fonts and OCR fonts (Optical Character Recognition) for use with scanning documents. Use these fonts in the same way as any other font.
You can only use one font per stamp. However, if you would like to use two (or more) fonts and have them appear as the same stamp, make a separate stamp item for each font. For each item use the same position for the stamp, but insert spaces (not tabs) in the Text parameter of each stamp as placeholders for the characters in the other stamp so the two items do not overlap. For example, to create a stamp that has both Helvetica and Symbol characters, have one item stamping Helvetica and one stamping Symbol. The Font and Text parameters are:
Item 1:
Font (Helvetica)
Text (The circumference of a circle is 2 r.)
Item 2:
Font (Symbol)
OffsetX (176)
Text ( p)
The resulting stamp will look like this:
The circumference of a circle is 2πr.
TextMode (optional)
TextMode specifies stamp text as an outline, solid, or invisible. TextMode is optional; if TextMode is omitted, text will be solid. TextMode has three options:
- 0 stamps text as solid characters.
- 1 stamps text as outlined characters.
- 3 stamps invisible text.
The figure below illustrates the use of the TextMode parameter values.
Invisible text can be a useful aid for searching through a document. Acrobat’s Text Tool can highlight invisible text, showing its location in a PDF document. However, you won’t be able to see the text and it will not appear in the printed document.
Text (required)
Text specifies the content of the stamp. Type text exactly as you want it to appear. The figure below illustrates using the Text parameter.
With the Text parameter you can use variables to stamp dynamic information, such as the date and time of stamping or page numbers in a variety of formats. See Using variables in stamp files for more information.
WordWrap (optional)
WordWrap specifies whether long lines of text should wrap. WordWrap is optional. If WordWrap is omitted, any lines too long will be cut off. There are two possible values for WordWrap:
- Yes, if a line of text is too long to fit between the margins specified, it will continue on subsequent lines.
- No, if a line of text is too long to fit between the margins specified, it will be cut off at the edge of the margin.
Note: Word wrapping only works for ASCII text. If you are stamping CJK fonts using Unicode, use the MultiLine parameter and manually insert line breaks to make multiple line stamps. Refer to Multi-Line UTF8/UTF16 Stamps for information on inserting line breaks.
CharSpace and WordSpace (optional)
CharSpace adjusts character spacing and WordSpace adjusts word spacing. Enter a positive real number with up to three digits following the decimal point. A positive value (greater than 0) will increase the spacing; a negative value (less than 0) will decrease the spacing. Default value is 0, no change in spacing.
LineSpace (optional)
LineSpace adjusts line spacing for multiple lines. Enter a positive real number with up to three digits following the decimal point. A value between 0 and 1 will decrease the line spacing; a value greater than 1 will increase the line spacing. LineSpace (2) will stamp multiple lines as doublespace.
Default value is 1, no change in linespacing.
BatesDigit (optional)
BatesDigit is used to specify the number of Bates digits for a stamp item containing a Bates stamp variable (%J or %C). If BatesDigit is set to 3, page 2 will be stamped as 002, a BatesDigit of 5 will stamp 00002. See Using Bates notation for page numbering for information about Bates numbering.
ColorSpace (optional)
ColorSpace specifies the text as grayscale or color. ColorSpace is optional; if ColorSpace is omitted, stamping will be done in DeviceGray. Specify the color of the stamp as follows:
- DeviceGray, a shade of gray. Use the Color parameter to specify the level of gray.
- DeviceRGB, a combination of Red, Green, and Blue values. Use the Red, Green, and Blue parameters to specify the color. This is common for on-line viewing.
- DeviceCMYK, a combination of Cyan, Magenta, Yellow, and Black values. Use the Cyan, Magenta, Yellow, and Black parameters to specify the color. This is common for print documents.
ColorSpace does not specify the color, only the type of color. You need to specify the color as described below.
Gray used with ColorSpace (DeviceGray) (optional)
Use Gray if your ColorSpace is DeviceGray. Gray is optional. If Gray is omitted, the stamped text will be black. Gray specifies a shade of gray, use a value between 0 and 100, where 0 is black and 100 is white. A Gray of 95 is a very light gray, and a Gray of 15 is a dark gray.
Gray (15)
The Color parameter used in previous versions of StampPDF Batch is supported for backward compatibility.
Red, Green, and Blue used with ColorSpace (DeviceRGB) (optional)
Use Red, Green, and Blue if your ColorSpace is DeviceRGB. Red, Green, and Blue are optional. If they are omitted, the text will be stamped black. The values for these colors can be in the range of 0–255, where 0 represents none of the color and 255 represents 100% of the color. You can combine varying amounts of the three color components to generate virtually any color. Here are some examples:
To create a purple stamp enter the following values for the color components:
Red (102)
Green (51)
Blue (204)
To create a green stamp enter:
Red (0)
Green (150)
Blue (0)
By not specifying the full 255 of green, a value of 150 will generate a lighter shade of green.
You must include values for each color: Red, Green, and Blue. Use a setting of 0 for colors you do not want.
Cyan, Magenta, Yellow, and Black used with ColorSpace (DeviceCMYK) (optional)
Use Cyan, Magenta, Yellow, and Black if your ColorSpace is DeviceCMYK. Cyan, Magenta, Yellow, and Black are optional. If they are omitted, the text will be stamped black. The values for these colors can be in the range of 0–1, where 0 represents none of the color and 1 represents 100% of the color. You can combine varying amounts of the four color components to generate virtually any color. Here are some basic examples:
To create the same color purple stamp enter the following values for the color components:
Cyan (0.63)
Magenta (0.76)
Yellow (0)
Black (0)
To create a yellow stamp enter:
Cyan (0)
Magenta (0)
Yellow (0.5)
Black (0)
By not specifying the full 1 of Yellow, a value of 0.5 will generate a lighter shade of yellow.
You must include values for each color: Cyan, Magenta, Yellow, and Black. Use a setting of 0 for colors you do not want.
Notes on Color: RGB vs. CMYK
If you’re not familiar with color spaces, you may be confused by the differences in the way colors are specified in RGB or CMYK.
RGB is a color space for televisions and computer monitors. Color is created by mixing red, green, and blue light. The maximum values result in white light. Since computer monitors are digital, RGB levels are specified in a four-bit word, from 0 to 255.
CMYK is a color space for printing. Color is created by mixing cyan, magenta, yellow, and black inks. The maximum values result in black ink. Ink levels are specified in percentages, from 0 to 1.
Notes on Color: How to select colors using RGB or CMYK components
Online, Visibone Webmaster’s Color Lab have tools to help you select a color. When you select a color that you like, the code for that color is given in RGB (Red, Green, Blue), CMYK (Cyan, Magenta, Yellow, and Black), and/or hexadecimal (used in HTML for web pages). Copy the RGB or CMYK values given and enter them into the corresponding parameters in the stamp file. You may also have software already installed on your computer that will help you design colors by accepting different values for color and displaying the results.
The values for RGB must be integers in the range 0–255. If you find colors defined as percentages, convert them to the 0–255 range. For example, 25% Red is 0.25 × 255 = 64. The values for CMYK must be in the range 0–1. If you find the colors defined as percentages, convert to decimal equivalent. For example 52% Cyan is 0.52.
Opacity (optional)
Opacity specifies the transparency of the text. Values range from 0 to 1, where 0 is completely transparent (invisible) and 1 is completely opaque. Opacity allows you to place a stamp over existing text or graphics without completely obscuring the original. As an example, for a watermark that says “Draft” or “Confidential” and is a medium transparency use the following line in the stamp item:
Opacity (0.3)
LinkURL (optional)
The LinkURL parameter specifies a URL link to be associated with a text stamp. Example below:
LinkURL (http://www.some_company.com/link_to_somewhere)
Note: If you wish to apply a LinkURL to a JPEG or TIFF image, you must create two stamp items in your stamp file. The first stamp item must be the image and the second stamp item must be the LinkURL you wish to stamp on the image.
AutoScale (optional)
This parameter will automatically scale your stamp to fit on the page without having to set any other options such as Page Margins. The value for AutoScale specifies the font size as a percentage of the larger dimension of the page size (example: if your document is 8 1/2 x 11, with AutoScale set to (3), the stamp would be set at 3% of 11 inches. By using the AutoScale parameter in your stamp items, you will be able to apply the same stamp across multiple files regardless of their page size.
A sample text stamp
The figure below shows the stamp item in letterstamp.txt to place a watermark looks like this:
# — Stamp Item — | Comment |
Begin_Message | Begin Stamp Item |
Name (Watermark) | Named Watermark |
Type (Text) | Text stamp |
StartPage (1) | Start on page 1 |
EndPage (-1) | Stamp to the last page |
PageIncrement (1) | Stamp every page |
Position (diag-topleft) | Position diagonally from the top left corner |
Justification (center) | Center it both vertically and horizontally on the page |
Underlay (yes) | Place it underneath existing text and graphics |
Size (84) | Text size is 84 points |
Font (Helvetica Bold) | Font is Helvetica Bold |
TextMode (1) | Text will be an outline |
Text (Confidential) | Text says “Confidential” |
WordWrap (no) | Do not wrap to a new line |
Opacity (1) | Text will be opaque |
Gray (50) | Medium gray color |
PageBox (CropBox) | Use CropBox to set page boundaries to position the stamp |
UndoLabel (undoStamp) | Name of the undo label to remove stamps |
End_Message | End Stamp Item |
Unicode – Stamping Unicode Text
Introduction
StampPDF Batch can use Unicode Asian characters in the Text parameter to stamp Asian language characters. The stamp Type must be set to UTF8 or UTF16, and the font set to one of 7 predefined Asian fonts. If the stamp will be on more than one line, the MultiLine parameter must also be set. The only place double-byte characters can be used is in the Text parameter.
Character encoding
Stamp files can be encoded as Plain Text (ISO-8859 or ISO Latin 1) or as UTF-8. If you are going to use Asian characters, we recommend using UTF-8 stamp files and a text editor that supports UTF-8.
Encoding (required for Unicode fonts)
Unicode fonts require an encoding parameter. The encoding parameter should be set to the following values depending on the type of text used.
Encoding (UTF8)
The possible values for encoding are:
Encoding | |
Non-CJK Text | UTF8 |
Japanese Text | UniJIS-UTF16-H |
Korean Text | UniKS-UTF16-H |
Simplified Chinese Text | UniGB-UTF16-H |
Traditional Chinese Text | UniCNS-UTF16-H |
Type UTF8
Enter the Asian characters directly into the Text parameter.
Only the Text parameter can have Asian fonts or any other higher level Unicode character. All other text in the file must use only the Latin character set (the first 128 characters, equivalent to “ASCII”). For example:
Type (UTF8)
Font (KozMinPr6N-Regular)
Encoding (UniJIS-UTF16-H)
Text
Note: UTF-8 encoded characters are converted to UTF-16 before stamping into the document. UTF-16 characters are stamped directly into the document with no intervention by StampPDF Batch. If you want to make sure your characters are stamped directly with no conversion, use UTF-16.
Type UTF16
Enter double-byte characters in big-endian hexadecimal. Each character is represented by four hex digits. Enter the entire Text parameter as a string of hex codes with no breaks or prefixes.
For example, to enter the three characters 5185 5BC6 306E, enter:
Type (UTF16)
Font (KozGoPr6N-Medium)
Encoding (UniJIS-UTF16-H)
Text (51855BC6306E)
Refer to Resources for help finding codes.
Multi-line UTF8/UTF16 stamps
In order to get multi-line text stamps, you must set the MultiLine parameter to yes. StampPDF Batch will not check for line separator characters if the MultiLine parameter is set to no. Use the following codes for the line separator:
For UTF8, use \r as a line separator character. Place \r directly into the text where you want the new line to start. For example:
Type (UTF8)
Font (KozMinPr6N-Regular)
Encoding (UniJIS-UTF16-H)
MultiLine (yes)
Text
For UTF16, place the Unicode line separator character 2028 in your text string where you want the new line to start. For example:
Type (UTF16)
Font (KozGoPr6N-Medium)
Encoding (UniJIS-UTF16-H)
MultiLine (yes)
Text (51855BC6306E202851855BC6306E)
Both Text parameters result in this stamp:
Font Support (StampPDF Batch 5.2 and later)
OpenType, TrueType,Type1 and Base14 fonts are all supported in StampPDF Batch 5.2. In previous versions, Type1 fonts were used in StampPDF Batch by including the FontFile parameter. In StampPDF Batch 5.2.2 you should only specify the font name.
In order to use a non-Base14 font, the font must be stored in one of the Appligent font directories (See Font Directories below). You can run the command
$ stamppdf –listfonts to see a list of all font names available for stamping. The font name should be used exactly as it is shown in the font list.
Below is a list of available fonts that are shipped with StampPDF Batch. You will see these fonts when you run -listfonts:
AdobeArabic-Bold
AdobeArabic-BoldItalic
AdobeArabic-Italic
AdobeArabic-Regular
AdobeFanHeitiStd-Bold
AdobeGothicStd-Bold
AdobeHebrew-Bold
AdobeHebrew-BoldItalic
AdobeHebrew-Italic
AdobeHebrew-Regular
AdobeHeitiStd-Regular
AdobeMingStd-Light
AdobeMyungjoStd-Medium
AdobePiStd
AdobeSongStd-Light
AdobeThai-Bold
AdobeThai-BoldItalic
AdobeThai-Italic
AdobeThai-Regular
CourierStd
CourierStd-Bold
CourierStd-BoldOblique
CourierStd-Oblique
KozGoPr6N-Medium
KozMinPr6N-Regular
MinionPro-Regular
MyriadPro-Regular
Font Directories:
There are two font directories. The default font directory is found under the AppligentHome directory in APDFLX.X.XResource/Font. On Windows, the AppligentHome directory is in the AllUsers Application data directory.
Windows 7 and later: C:\ProgramData\Appligent
Unix: /usr/local/appligent
You can also specify an additional font directory, the AP font directory. The path to the AP font directory is saved in an environment variable called AP_FONT_DIR. You will be prompted to enter a font directory during installation. The fonts that are in the AP_FONT_DIR will also show in addition to the fonts that are shipped with StampPDF Batch when you run -listfonts.
On Windows: Environment variables can be set on Windows under the System Properties. To display the System Properties, right click on “My Computer” and select properties. On the bottom of the Advanced tab, click the button labeled “Environment Variables”. Under system variables, you will see an entry for AP_FONT_DIR. Select this entry, and click edit. You can then change the variable’s value to the path of the current font directory.
On Unix: As the other environment variables for StampPDF Batch, AP_FONT_DIR is set in the stamppdf script. The directory set in an environment variable in the script, or be set for the shell. See ManualInstall.pdf for more information on setting the AP_FONT_DIR and other environment variables on Unix.
Available fonts (StampPDF Batch 5.1 and earlier)
The table below lists the seven fonts that are available for double-byte character stamping:
Font Name in StampPDF Batch | Font Name in Acrobat |
---|---|
HeiseiKakuGo-W5 | Heisei Kakugo |
HeiseiMin-W3 | Heisei Mincho |
HYGoThic-Medium | HYGoThic Medium |
HYSMyeongJo-Medium | HYSMyeongJo Medium |
MHei-Medium | MHei-Medium |
MSung-Light | MSung Light |
STSong-Light | STSong Light |
Use the font name in the left-hand column above in the Font parameter in your stamp file.
Prerequisites for Acrobat full version
In order to use Acrobat to view and print Asian text, you must have Asian language support files installed for both the Operating System (OS) and Acrobat. The table below shows whether Asian font support is automatically installed for your combination of OS and Acrobat, or whether you have to manually install it.
Unicode Font Support for Windows and Mac OS X and Acrobat.
OS | Font Support | |||
---|---|---|---|---|
Version | Automatic | Manual | ||
OS | Windows | 7 and higher |
|
|
Mac | OS X | |||
Acrobat | Windows | X and higher | ||
Mac OS X | X and higher |
Operating System
Asian font support is automatically installed for all OS platforms except Windows 2000/NT. To install Asian font support, open Regional Options in the Control Panel, and add the fonts you want. You may need your original installation disk. Refer to the Windows on-line help for more information. You can also install keyboard support.
Acrobat
Asian font support is automatically installed only in Acrobat X under Mac OS X. For all other versions, you will need to do a custom installation, and choose to install Asian font support. Refer to the Acrobat on-line help for more information.
Prerequisites for Adobe Reader®
In order to use Adobe Reader to view and print Asian text, you must install the Asian Font Pack from Adobe Systems.
Windows/UNIX
Download and install the Asian Font Pack.
Reader components can be updated in a variety of ways. Some updates are available when you open a PDF that triggers the updating process automatically. For example, if you open a form that uses Asian language fonts, Reader asks whether you want to download the fonts. Other updates are available only from the Help menu, and you must install them manually. Some updates are available both automatically and manually.
Mac OS X
You cannot download the Asian Font Pack for Mac OS X. You must choose to install it when you install Acrobat Reader. If you did not, you must reinstall Reader.
Resources
- The Unicode Consortium has the complete Unicode specification, providing a wealth of information on Unicode, character sets, and conversions.
- SC UniPad provides a free trial of UniPad, a Windows-based Unicode text editor.
- IT and communication provides an extensive tutorial on character sets, including Unicode.
Variables – Using Variables in Stamp Files
Introduction
When you are working with documents, there is a lot of information that varies from document to document such as dates, times, filenames, etc. Even within a document there are things that change from page to page, such as page numbers or headers and footers. StampPDF Batch provides variables that can stamp this information into your document.
Variables substitute for text in the Text parameter. Each variable is case sensitive and has a specific output. They are replaced at run-time with the information they represent. The variables can mix with text. For example, to stamp the date a file was created, create a stamp item with the following Text parameter:
Text (This file was created on %a., %b. %d.)
The stamp appears as:
This file was created on Wed., Oct. 07.
Notice that we placed the appropriate punctuation as needed.
All variables must be preceded by the percent (%) character. If the % character is missing, the variable name will appear in the stamped text (“a” instead of “Wed”). If you want to use the % character in a stamp, it must be listed in the stamp file as %%.
The Variables
The table below lists all the variables showing the variable name, what it does, and example output.
Variable | Format | Example Output |
---|---|---|
%A | full weekday name | Friday |
%a | abbreviated weekday name | Fri |
%B | full month name | October |
%b | abbreviated month name | Oct |
%<page number>C | consecutive Bates numbering across files | 000001 |
%c | local date and time | Friday, October 03, 2003 7:36:24 PM |
%D | ordinal suffix for dates | 1st, 2nd, 3rd, 4th etc. |
%d | day of month | 15 |
%G | total number of pages | 30 |
%<page number>g | page number | 1 |
%H | hours, 00–23 | 13 |
%I | hours, 01–12 | 01 |
%<info field name>i | PDF info dictionary value: Author, Title, Subject, Keywords | Sample.pdf (Title), Jane Smith (Author), Security (Keywords) |
%<page number>J | Bates page numbering up to 999999 | 000001 |
%j | day of the year, 001–366 | 099 |
%M | minutes, 00–59 | 25 |
%m | month, 1–12 | 10 |
%N | document filename | file.pdf |
%n | new line; use for multi-line stamps | sample stamp, line 1 sample stamp, line 2 sample stamp, line 3 |
%P | full document pathname | c:\MyDocuments\Stamp1.pdf |
%p | local equivalent of AM or PM | PM |
%r | lowercase Roman numerals for page numbers | xii |
%R | uppercase Roman numerals for page numbers | XII |
%S | seconds, 00–61 | 10 |
%U | week of the year, 01–53 where Sunday is the first day of the week | 36 |
%W | numeric week of the year, 00–53 where Monday is the first day of the week | 36 |
%w | numeric weekday, 0–6 where Sunday is 0 | 5 |
%X | local time representation | 05:35:10 |
%x | local date representation | 10/03/03 |
%Y | year with century | 2003 |
%y | year without century, 00–99 | 03 |
%% | % (use when stamp must include percent symbol) | % |
A sample stamp item using variables
For example, the figure below shows the stamp item in letterstamp.txt to place the current date:
# — Stamp Item — | Comment |
Begin_Message | Begin Stamp Item |
Name (Current Date) | Named Current Date |
Type (Text) | Text stamp |
StartPage (1) | Start on first page |
EndPage (-1) | Stamp to the first page |
PageIncrement (1) | Stamp every page |
Top (620) | Top margin 620 points from bottom of page |
Left (44) | Left margin 44 points from left side of page |
Position (top) | Position the top of the text along the top margin |
Justification (left) | Left justify the text |
Underlay (no) | Place it over existing text and graphics |
Size (12) | Font size 12 points |
Font (Helvetica) | Font Helvetica |
TextMode (0) | Solid text |
Text (%A %B %d, %Y) | Insert Weekday Month day, year |
WordWrap (No) | Do not wrap to a new line |
Gray (0) | Black text |
Opacity (1) | Text will be opaque |
UndoLabel (undoStamp) | Name of the undo label to remove stamps |
End_Message | End Stamp Item |
Stamping page numbers
Use the variable %<page number>g to stamp page numbers onto your document. <page number> is optional, the default value is the logical number of the page. You can specify a different page to start with the parameter StartPage, the default for start page is the first page.
For example, if you would like page numbering stamps to begin on page 5, you need to tell StampPDF Batch two things:
- Where to begin stamping: use StartPage (<page number>) in your stamp file
- What number to use when stamping that page: use Text (%<page number>g) in your stamp file
If you do not want to stamp page numbers to the end of the file, you can also specify an EndPage.
The following examples show how to apply page numbers for different circumstances.
Example: Start on the first page with page number 1
To start numbering on the first page, using page number 1, your stamp item would have the following line:
Text (%g)
The default start page is 1, and the default page number would be 1, the logical number of the page.
Example: Start on page 5 with page number 5
To start numbering on the page 5, using page number 5, your stamp item would have the following lines:
StartPage (5)
Text (%g)
The start page is specified as page 5, and the default page number would be 5, the logical number of the page.
Example: Start on page 5 with page number 1
To start numbering on the page 5, using page number 1, your stamp item would have the following lines:
StartPage (5)
Text (%1g)
The start page is specified as page 5, and the page number is specified as 1. You can use this to start numbering the body of a document at 1 when the body starts after 4 pages of introductory material.
Using Bates notation for page numbering
Use the variable %<page number>J to stamp page numbers using Bates notation. With Bates notation each page number uses a fixed number of digits, filled with leading zeros. For example, with a six-digit Bates number (the default), page 2 will be written as 000002 and page 4145 will be written as 004145.
If you want to use a number of digits other than the default six-digit format use the BatesDigit parameter. For example, to change page 2 to be written as 0002 and page 4145 to be written as 4145, your stamp item would have the following line:
BatesDigit (4)
You can also specify how many digits to use when you run StampPDF Batch by using the -j option on the command-line. Refer to -j<n> for more information.
Note: The value of the BatesDigit parameter will override the -j option.
If you would like to start numbering at a number other than 000001, place the number to start between % and J. For example, to start numbering at page 000501, use %501J in the Text parameter as shown in the figure below. StampPDF Batch will insert the leading zeros.
Adding a prefix to Bates numbers
You can add a prefix to Bates numbers by including the prefix before the variable, such as prefix text CaseABCD. The example below will stamp the StartPage with CaseABCD 000001, the next page with CaseABCD 000002, and so on.
CaseABCD %J
Prefixes can be combined with custom start pages. The example below will start page numbering at CaseABCD 000501.
CaseABCD %501J
Bates numbering across files
Use the variable %<page number>C to stamp Bates page numbers across multiple files. For example, if you stamp files Input001.pdf to Input005.pdf, and use the %C variable in your stamp file, the pages would be numbered as shown in the table below:
Filename | Number Of Pages |
Bates Number Stamped |
---|---|---|
Input001.pdf | 23 | 000001 to 000023 |
Input002.pdf | 42 | 000024 to 000065 |
Input003.pdf | 25 | 000066 to 000090 |
Input004.pdf | 17 | 000091 to 000107 |
Input005.pdf | 37 | 000108 to 000144 |
The files must be stamped at the same time. Refer to Stamp several documents with one stamp file for information on how to stamp multiple files at the same time.
Creating multi-line stamps
Use the %n variable to create a new line (or carriage return) in the stamped text. For example, if you would like to stamp a company address as a header, enter the text of the stamp in your Text parameter, including a %n wherever you wish a line break:
Text (Appligent, Inc.%n22 East Baltimore Avenue%nLansdowne, PA 19050 USA)
The stamp will appear as shown below:
Appligent, Inc.
22 East Baltimore Avenue
Lansdowne, PA 19050 USA
There is no limit to the amount of text or number of lines you can use. You are limited only by the size of the page or the margins you have set.
Note: If you will be stamping footers at the bottom of the page, StampPDF Batch begins stamping at the Bottom margin. To prevent your stamp from running off the page, increase the Bottom margin.
Stamping information from Document Properties fields
The Document Properties are from Adobe Acrobat or Acrobat Reader or other quality PDF viewers. Within Acrobat or Acrobat Reader, select File > Properties > Description. A dialog window will appear:
StampPDF Batch can access the information here and stamp it into your PDF file. Take care to specify the variables exactly as they appear in the Document Properties dialog using exact capitalization and spelling:
- %i(Title)
- %i(Author)
- %i(Subject)
- %i(Keywords)
For these variables to stamp correctly on a PDF document, the information must be present in the Document Properties fields. If you enter a Text parameter to stamp Author and the Author field is blank in the Document Properties dialog window, StampPDF Batch won’t stamp any information for this variable.
Image and PDF Page Stamps – Stamping Pages on Pages
Introduction
You can also stamp images onto a document. Images for stamping can be in JPEG, TIFF, or PDF format. Both standard JPEG and Photoshop JPEG formats are supported.
For convenience, the parameters that pertain to image stamping are repeated here:
Type | Parameter | Text | Image | Default | Comments | |
---|---|---|---|---|---|---|
Begin | Begin_Message |
|
Start of stamp item | |||
Label | Name | Name of stamp | ||||
UndoLabel | Permits the later removal of a stamp | |||||
Type | Required: Specifies type of stamp | |||||
Pagination | StartPage | 1 | Start page for stamp | |||
EndPage | -1 | End page for stamp | ||||
PageIncrement | 1 | How many pages to skip between stamps | ||||
PageRange | all | Which individual pages to stamp | ||||
Positioning | Bottom, Left | From Options Block | Margins for stamp. Overrides margin values in options block | |||
Position | Top | Position and orientation on page | ||||
Justification | Center | Left,right or center | ||||
Angle | 0 | Angle to rotate text stamp | ||||
Underlay | No | Above (no) or beneath (yes) existing text/images | ||||
PageBox | cropbox | Sets which set of page boundaries are used to position the stamp | ||||
OffsetX | Horizontal placement offset | |||||
OffsetY | Vertical placement offset | |||||
Image Options | Path | Location of image file | ||||
Scale | Specify size of image | |||||
PageNumber | The page of a PDF to be stamped | |||||
End | End_Message | End of stamp item |
Note: In older versions of StampPDF Batch, only the Left and Bottom values are used for image stamping. StampPDF Batch will ignore values for Right and Top. With version 5.0, all four coordinates (top, bottom, left and right) are used to position and scale the image. With all four coordinates set, the Scale parameter is ignored. If you wish to use the Scale parameter, you should only specify Left and Bottom margins for the image stamp item.
Stamp parameters — detailed description
The Label, Pagination, and Positioning parameters work as they do with text stamps. The parameters exclusive to Image stamps are described below.
Label parameters
Type (required)
Type specifies the kind of image that will be stamped. Images include JPEG and TIFF. PDF images are defined as a separate type. To specify the type of image use the following:
Image to stamp a JPEG or TIFF image file
Type (Image)
PDF to stamp a page from a PDF file
Type (PDF)
Image options parameters
Path (required)
Path specifies the location of the image file to stamp. Enter the directory path, using the full path is best practice, and use the convention that is native to your operating system. Windows separates directories with backslashes: \, while UNIX systems use forward slashes: /. For the image called Image.jpg in our samples directory path will look like this on Windows:
Path (C:\Appligent\StampPDFBatch\Samples\Image.jpg)
Scale (optional)
The Scale parameter increases or decreases the size of the original image when it is stamped onto the PDF document. A scale of 0.5 will make the image half (50%) of its original size, while a scale of 2 (200%) will double it.
Notes on positioning image files
Positioning works differently for images than it does for text.
For text, margin settings and positioning parameters act together to position a text stamp. The Top, Right, Bottom and Left parameters specify a rectangle, and the Position and Justification parameters place the text within that rectangle.
For images, the Bottom and Left parameters specify the location of the bottom left corner of the image.
The Position and Justification parameters are alternate means of specifying position. Use the Position parameter in place of Bottom for vertical positioning, and the Justification parameter in place of Left for horizontal positioning:
- Bottom overrides Position. If you specify a Bottom value, any Position value is ignored.
- Left overrides Justification. If you specify a Left value, any Justification value is ignored.
For example, you could specify that the left and bottom corner is a (0,0), but then you cannot center the image on the page as well.
In either case, use the Scale parameter to size the image.
A sample image stamp item
For example, the figure below shows the stamp item in letterstamp.txt to place a signature:
# — Stamp Item — | Comment |
Begin_Message | Begin Stamp Item |
Name (Signature) | Named Signature |
UndoLabel (undoStamp) | Name of the undo label to remove stamps |
Type (Image) | Image stamp |
StartPage (-1) | Start on last page |
EndPage (-1) | Stamp to the last page (stamp only last page) |
Left (50) | Left, bottom corner of image is 50 points from left edge of page |
Bottom (225) | Left, bottom corner of image is 225 points from bottom of page |
Underlay (No) | Place it over existing text and graphics |
Path (./samples/sig.jpg) | Use image file named sig.jpg in ./samples directory |
Scale (1) | Place image at actual size |
PageBox (CropBox) | Use CropBox to set page boundaries to position the stamp |
End_Message | End Stamp Item |
Using a page from a PDF file as the Stamp
Set the Type parameter to PDF to stamp a PDF file onto your document. For example, if you have a company letterhead in PDF format, you can stamp this on all your computer generated invoices to create personalized, professional invoices.
Some notes about stamping PDF files:
- If the PDF document contains more than one page, the first page will be stamped onto your document by default. If you want to stamp an image of a different page use the PageNumber parameter listed below.
- PDF files are usually full page size. PDF stamps are convenient for stamping information that is already positioned on a page so you don’t have to worry about manually placing individual elements by specifying position in points.
- The white areas in a PDF stamp are not transparent. Make sure the stamp does not interfere with the content of your document and that you set Underlay to Yes. You can also crop the PDF page in Acrobat if the stamp does not fill the entire page to remove extra white areas.
Image options parameters
PageNumber (optional)
If you are placing an image of Type (PDF), and the PDF document has more than one page in the file, use the PageNumber option to specify the PDF page number that has the PDF image you want to stamp into your document. If you do not enter a PageNumber, the first page of the PDF will be used as the image stamp.
A sample PDF stamp item
For example, the figure below shows the stamp item in letterstamp.txt to place a PDF file looks like this:
# — Stamp Item — | Comment |
Begin_Messge | Begin Stamp Item |
Name (Appligent Logo) | Named Appligent Logo |
Type (PDF) | PDF Stamp |
StartPage (1) | Start on first page |
EndPage (-1) | Stamp to the last page |
Bottom (0) | Left, bottom corner of image is on the left edge of page |
Left (0) | Left, bottom corner of image is on the bottom of page |
Underlay (No) | Place it over existing text and graphics |
Scale (1) | Place image at actual size |
Path (./samples/letterhead.pdf) | Use image file named letterhead.pdf in ./samples directory |
End_Message | End Stamp Item |
Barcodes – Stamping 1 and 2D Barcodes
Specify stamping a barcode by setting the Type parameter to Barcode:
Type (Barcode)
StampPDF Batch directly supports the following types of 1 and 2D barcodes:
Barcode Type | StampPDF Code Keyword |
---|---|
Code 128 | 128 |
Code 3 of 9 | 39 |
Codabar | Codabar |
DataMatrix ECC200 | DataMatrix |
DotCode | DotCode |
Han Xin Code 汉信码 | HanXin |
Japan Post | JapanPost |
Korea Post | KoreaPost |
PDF 417 | PDF417 |
Postnet | Postnet |
QR Code | QR |
UPC-A | UPCA |
UPC-E | UPCE |
Additional codes will be added in future releases. If you need a barcode which is not currently supported; please contact Appligent Support.
Barcode parameters
Code
Specifies the barcode type. Use instead of Font and FontFile. StampPDF Batch currently supports Code 128. Use:
Code (128)
to specify a Code 128 barcode.
StampPDF Batch uses Code 128 character set B. A simple Code 128 barcode (i.e., one character set) consists of a start character, the coded data, a calculated symbol check character, and an end character. StampPDF Batch automatically calculates the check character and places the start, check, and stop characters in the appropriate place. You only need to specify the data.
Size
Specifies the size of the barcode in points. 72 points equals one inch, so to meet UCC requirements of a minimum of 0.5 inch, specify 36 points
Default value: 12 points
Scale (optional)
The Scale parameter increases or decreases the size of the barcode when it is stamped onto the PDF document. A scale of 0.5 will make the image half (50%) of its original size, while a scale of 2 (200%) will double it.
Barcode Example
The figure below shows a stamp item that stamps a plain barcode at the bottom of the page.
# — Barcode Item — | Comment |
Begin_Message | Begin Stamp Item |
Name (BarcodeTest) | Named BarcodeTest |
Type (Barcode) | Barcode stamp |
Code (128) | Create Code 128 barcode |
StartPage (1) | Start on first page |
EndPage (1) | Stamp only first page |
Position (Bottom) | Position barcode on bottom of page |
Justification (Center) | Center barcode |
Underlay (no) | Place it over existing text and graphics |
Size (36) | Size of barcode 36 points (1/2 inch) |
Scale (0.5) | Stamp barcode at 50% of its original size |
Text (This is a test) | Text of barcode “This is a test” |
End_Message | End Stamp Item |
2D Barcode Example
The figure below shows a stamp item that stamps a plain barcode at the bottom of the page.
# — Barcode Item — | Comment |
Begin_Message | Begin Stamp Item |
Name (2D Barcode Test) | Named 2D Barcode Test |
Type (Barcode) | 2D Barcode stamp |
Code (DataMatrix) | Create DataMatrix barcode |
StartPage (1) | Start on first page |
EndPage (1) | Stamp only first page |
Position (Bottom) | Position barcode on bottom of page |
Justification (Center) | Center barcode |
Underlay (no) | Place it over existing text and graphics |
Text (This is a test) | Text of barcode “This is a test” |
End_Message | End Stamp Item |
Page Transform – Resizing and Moving the Page
Introduction
StampPDF Batch has a special type of Stamp Item which can scale and transform the page. This is typically used to reduce the size of the page and create white space at the top and right side of the page. This is useful for stamping text along the top and/or right edge of the page and ensuring the stamped text is not obscuring any of the page content.
Type (PageTransform)
Page Transform parameters
PageTransform
Specifies that this is a PageTransform item type.
PageScale (93)
to specify scaling the page to 93 percent of its original size.
Note: PageTransform is only applied to the page once. So, if you Undo the stamp as part of a document workflow, the document can continue through the workflow without be scaled multiple times.
Example
The figure below will scale all of the pages in the document to 93 percent of their original size.
# — Barcode Item — | Comment |
Begin_Message | Begin Item |
Name (Page Transform Test) | This item is named Page Transform Test |
Type (PageTransform) | Specify this is a PageTransform item |
PageScale (93) | Scale Page to 93 percent of its original size |
StartPage (1) | First page to transform |
EndPage (-1) | Transform all pages in the document |
End_Message | End Item |
Example – Letterstamp Text Stamping with Variables
The example below shows the entire letterstamp.txt including the examples we’ve been using throughout this chapter.
Note This example is heavily commented to explain how the file works, and in normal use you do not need to include the comments.
#Options Comment
Begin_Options Begin Options block
Version (2) Stamp file format version 2
TopMargin (36) Top margin 36 points (1/2 inch)
BottomMargin (36) Bottom margin 36 points (1/2 inch)
LeftMargin (36) Left margin 36 points (1/2 inch)
RightMargin (36) Right margin 36 points (1/2 inch)
ViewMode (FitPage) Open document to see entire page
OpenMode (ShowNone) Do not show navigation pane
End_Options End Options block
# -- Stamp Item 1 Comment
Begin_Message Begin Stamp Item
Name (Appligent Logo) Named Return Address
Type (PDF) PDF stamp
StartPage (1) Start on first page
EndPage (-1) Stamp to the last page
Scale (1) Add Scale parameter
Left (40) Offset from left side
Underlay (no) Place it over existing text and graphics
Path (./samples/letterhead.pdf) Use image file named letterhead.pdf in ./samples/directory
PageBox (CropBox) Use CropBox to set page boundaries to position the stamp
End_Message End Stamp Item
# -- Stamp Item 2 Comment
Begin_Message Begin Stamp Item
Name (Current Date) Named Current Date
Type (Text) Text stamp
StartPage (1) Start on first page
EndPage (-1) Stamp to the last page
PageIncrement (1) Stamp every page
Top (620) Top margin 620 points from bottom of page
Left (44) Left margin 44 points from the left of page
Position (top) Position of top of the text along the top margin
Justification (left) Left justify the text
Underlay (no) Place it over existing text and graphics
Size (12) Font size 12 points
Font (Helvetica) Font Helvetica
TextMode (0) Solid text
Opacity (1) Text will be opaque
Text (%A %B %d, %Y) Insert Weekday Month day, Year
WordWrap (No) Do not wrap to a new line
Gray (0) Black text
PageBox (CropBox) Use CropBox to set page boundaries to position the stamp
UndoLabel (undoStamp) Name of the undo label to remove stamps
End_Message End Stamp Item
# -- Stamp Item 3 Comment
Begin_Message Begin Stamp Item
Name (Watermark) Named Watermark
Type (Text) Text stamp
StartPage (1) Start on page 1
EndPage (-1) Stamp to the last page
PageIncrement (1) Stamp every page
Position (diag-topleft) Position diagonally from the top left corner
Justification (center) Center it both diagonally and horizontally on the page
Underlay (Yes) Place it underneath existing text and graphics
Size (84) Text size is 84 points
Font (Helvetica Bold) Font is Helvetica Bold
TextMode (1) Text will be an outline
Text (Confidential) Text says "Confidential"
Opacity (1) Text will be opaque
WordWrap (No) Do not wrap to a new line
Gray (50) Medium gray color
PageBox (CropBox) Use CropBox to set page boundaries to position the stamp
UndoLabel (undoStamp) Name of the undo label to remove stamps
End_Message End Stamp Item
# -- Stamp Item 4 Comment
Begin_Message Begin Stamp Item
Name (Signature) Named Signature
UndoLabel (undoStamp) Name of the undo label to remove stamps
Type (Image) Image stamp
StartPage (-1) Start on last page
EndPage (-1) Stamp to the last page(stamp only last page)
Left (50) Left, bottom corner of image is 50 points from left edge of page
Bottom (225) Left, bottom corner of image is 225 points from bottom of page
Underlay (No) Place it over existing text and graphics
Path (./samples/sig.jpg) Use image file named sig.jpg in ./samples directory
Scale (1) Image places at actual size
PageBox (CropBox) Use CropBox to set page boundaries to position the stamp
End_Message End Stamp Item
# -- Stamp Item 5 Comment
Begin_Message Begin Stamp Item
Name (Disclaimer) Named Disclaimer
Type (Text) Text stamp
StartPage (1) Start on first page
EndPage (-1) Stamp to the last page
PageIncrement (1) Stamps every page
Position (bottom) Positioned along bottom of page
Justification (center) Center the text on page
Underlay (No) Place it over existing text and graphics
Size (12) Font size 12 points
Font (Helvetica Bold) Font Helvetica Bold
TextMode (0) Solid Text
Text (StampPDF Batch%nSignature) Insert disclaimer text. Note %n variable to insert a line break
WordWrap (No) Do not wrap to a new line
Opacity (1) Text will be opaque
Red (220) Light Red
Green (67)
Blue (71)
PageBox (CropBox) Use CropBox to set page boundaries to position the stamp
UndoLabel (undoStamp) Name of the undo label to remove stamps
End_Message End Stamp Item
# Appligent, Inc. Comment
StampPDF Batch Options
StampPDF Batch Options
Refer to General Command-Line Options for details on the general options.
Refer to Applying Standard Security for more information about the -d option and working with encrypted documents.
The following is an example of command syntax for StampPDF Batch.
$stamppdf [options] stampfile.txt input1.pdf [input2.pdf...]
The table below shows command-line options for StampPDF Batch.
Options summary
Option | Parameter | Description |
---|---|---|
-u | string | Removes stamps labeled with UndoLabel |
-j | Integer | Number of digits for Bates numbering |
-sameversion | Use the same PDF version as the input PDF file | |
-arabicfixedlength | Do not increase the length of Arabic text | |
-vars | string | List of variables to be substituted in the Stamp File ( “name,value,name,value” ) |
-vardelimiter | string | Delimiter character for variables in the stamp file |
-cmds | CommandFile.txt | Process multiple command and files. Compatible with -l, -p, -r, -n, and -h or -help |
-watch | File_Path | path to watched folder base directory |
-watchin | File_Path | path to input watched folder; optional |
-watchout | File_Path | path to output of watched folder; optional |
-u <UndoLabel>— Remove old stamps with UndoLabel (can be used more than once with different label)
Removes stamps that were labeled with in the stamp file. StampPDF Batch cannot remove stamps applied without an UndoLabel. You can use the -u option repeatedly on the same command line to remove stamps with different UndoLabels at the same time. You cannot stamp a document and remove stamps at the same time. Choose one action or the other. See UndoLabel (optional) for more information.
Note: Keep a record of UndoLabel parameter names. UndoLabel names are case-sensitive. You cannot remove a stamp unless you include the exact UndoLabel name in the command.
-j <integer>— Number of characters in Bates numbers (default 6)
Specifies the number of digits when using Bates page numbering with the %J or %C variable. Page numbers are filled in with leading zeros to always have a specific number of digits. See Using variables in stamp files for more information.
The default value is 6.
-sameversion — Use the same PDF version as the input PDF file
If the option -sameversion is set and the original version of a PDF is 1.4 or later, the original version is used. If the option -sameversion is set and the original version is earlier than 1.4, the stamped PDF will be version 1.4. The only exceptions arise if either of the options -comp or -iso32000 are set, in which case the stamped PDF will be version 1.7.
-arabicfixedlength — Do not increase the length of Arabic text
The output Arabic text will have the same length as the input text. This option is related to how the ICU library performs “Arabic shaping”, it inserts extra Unicode characters to improve the appearance of the text. If more room is necessary, then the application will try to consume spaces next to modified characters.
Command Line Variable Substitution
-vars <string>— List of variables to be substituted in the Stamp File ( “name,value,name,value” )
StampPDF Batch will be able to replace variables found within the stamp file, and thus substitute the text that it stamps based on parameters set on the command line. 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.
The command line uses the “-vars” flag to assign a value to each stamp. StampPDF Batch replaces each variable name (including the percent signs) by its value. The first part is the variable name set in the stamp file and the information following after the comma is the value for that variable. For example, if you have Text Parameters set with %First_Name% and %Last_Name% in the stamp file, your command line would look similar to the example below:
stamppdf -p -o outfile.pdf -vars "First_Name,Jane,Last_Name,Doe" StampFile.txt InputFile.pdf
There are rules that govern text replacement:
1) Variable names can consist of some characters from the ASCII range 32-126, including upper and lower case letters, numbers, spaces (but not leading or trailing spaces), and underscores.
2) Values can contain any UTF-8 characters except null.
3) Two consecutive commas in a value field are treated not as separators, but as a single comma that is part of the value.
4) A %variable-name% in the stamp file Text parameter that is not part of the -vars option will be left unchanged, but be aware that the percept sign, when coupled with the character following it, could be construed as a stamp variable, leading to unexpected results.
5) When you specify -vars on the command line, each stamp must have an even number of percent signs. If you want to mix new text replacement variables and traditional stamp variables in the same stamp file, you will need to add an additional percent sign in front of the StampPDF Batch built-in variable. The Text Parameters in your stamp file would look similar to the example below:
Text (Page %%g) ---- this is a StampPDF Batch built-in variable for Page number.
Add an extra % in front of the %g variable
Text (My Full Name is %First_Name% %Last_Name%)
If you omit the -vars flag from the command line, %%g in the Text parameter above will be stamped as %g on the output PDF file.
6) You can also add StampPDF Batch built-in variables to the command line. Please note, you need to add double quotes around the built-in variables on Windows and single quotes on Unix. Example of Text Parameter in the stamp file:
Text (Today is %My_Date%)
Windows: stamppdfapp.exe -p -o BuiltInVariable.pdf -vars "My_Date,%c" StampFile.txt InputFile.pdf
Unix: stamppdfapp -p -o BuiltInVariable.pdf -vars 'My_Date,%c' StampFile.txt InputFile.pdf
NOTE: Text substitution on the command line must be composed of letters, numbers, underscores, and spaces, with no leading or trailing space.
NOTE: If you are using built-in variables and command line variables in the same stamp file, you need to use a different character other than the percent sign % to represent the command line variable in the stamp item. For example, stamp item should appear as:
Text (#First_Name# #Last_Name# %B %d %Y)
stamppdfapp -p -o out.pdf -vars “First_Name,Jane,Last_Name,Smith” -vardelimiter # StampFIle.txt Input.pdf
Microsoft attaches special meaning to a BunchOfChars%BunchOfChars%. So, there may be cases where the user tries to use percent signs in the values in -vars, but Microsoft intervenes.
Another place where Microsoft uses percent signs is in the syntax of its DOS for command. There could be some mis-interpretation.
Command Collections
-cmds — Command Collections allow you to process a collection of files at one time
To process multiple commands quickly and efficiently, use the -cmds option. The file specified by -cmds, the commands file, should contain one or more single line commands. Each command is just like an ordinary StampPDF Batch command-line without the executable name. The commands file does not support wildcards in filenames. The following is an example of command line syntax when running with -cmds:
$ ./stamppdf -p -l logfile.txt -cmds CommandFile.txt
CommandFile.txt contains a list of commands for StampPDF Batch to process. This is an example of the CommandFile.txt:
-p -iso32000 /appligent/stampbatch/samples/stampfile1.txt -o /appligent/stampbatch/samples/out_sample1.pdf /appligent/stampbatch/samples/sample1.pdf
-p -optimize /appligent/stampbatch/samples/stampfile2.txt -o /appligent/stampbatch/samples/out_sample2.pdf /appligent/stampbatch/samples/sample2.pdf
-p -w /appligent/stampbatch/samples/stampfile3.txt -o /appligent/stampbatch/samples/out_sample3.pdf /appligent/stampbatch/samples/sample3.pdf
Watched Folders
-watch — path to watched folder base directory
Activates the watch directory and executes the specified processing options when a document is dropped into the directory. All of the options can be used with the -watch option except the following: -h, -help, and -v.
To create a watch directory:
Make a new directory on the server
Open an instance of the server.
Change your working directory to the StampPDF Batch directory. The default location for StampPDF Batch on Windows is C:\Appligent\StampPDFBatch\. On other platforms, it will be wherever you installed it.
Enter the following command:
$stamppdf [options] -watch
The command activates the watch directory and runs continuously in the background, processing whatever options are specified. It also creates four subdirectories; error, in, original, and out, which are used during document processing
Example: Create a subdirectory called StampedFiles in the StampPDF Batch samples directory. Then enter the following command to activate it as a watch directory for stamping files.
In Windows:
>stamppdf.bat -p .\samples\stampitems1.txt -watch .\samples\StampedFiles\
In UNIX:
$stamppdf -p ./samples/stampitems1.txt -watch ./samples/StampedFiles/
Following activation of the watch directory:
Give users access to the server so that they can use the watch directory
If you want to create multiple watch directories, repeat the steps using a new directory name and new server instance for each watch directory.
Processing documents with watch directories
To process documents using a watch directory:
Open the file management application in your GUI (graphical user interface).
Access the server where the watch directory is located.
Place the documents to be processed in the watch directory’s “in” subdirectory.
Retrieve the processed files from the watch directory’s “out” subdirectory.
Example: If a watch directory named StampedFiles has been set up, drag, copy, or FTP your PDF documents to its “in” subdirectory.
When the documents have been processed, the original files are moved to a subdirectory called “original” and the processed files are placed in a subdirectory called “out”. If there are any problems with the input files, they will be moved to the “error” subdirectory.
-watchin — path to input watched folder; optional
Path to input watched folder. Optional.
-watchout — path to output of watched folder; optional
Path to output watched folder. Optional.
Running StampPDF Batch
Running StampPDF Batch
The minimum recommended form of the StampPDF Batch command is:
$stamppdf -o output1.pdf stampfile.txt input1.pdf
This stamps the file input1.pdf with the stamps described in stampfile.txt, and saves the resulting file with the new stamps as output1.pdf. The original input1.pdf remains unstamped.
Use the -l and -p options to create a log file or print to the screen feedback about the operation of StampPDF Batch:
$stamppdf -o output1.pdf -l logfile.txt -p stampfile.txt input1.pdf
Note: Order is important. In the example above, we have the following elements:
- The stamppdf command
- Options
- The stamp file
- The input file
The -o and -l options must be followed by filenames or you won’t get the results you expect.
Stamp several documents with one stamp file
StampPDF Batch can stamp several PDF documents with the same stamp file at one time, but can only use one stamp file at a time. There are a couple of ways to do this:
- List multiple files on the command line
- Use wildcards
Note: If you use the -o option, specify the name of an existing directory. If you specify a filename, all but the first of your original files will be overwritten.
Listing multiple files
The following command stamps both Sample1.pdf and Sample2.pdf at the same time as defined by StampItems1.txt:
$stamppdf StampItems1.txt Sample1.pdf Sample2.pdf
Using wildcards
Instead of listing all the files on the command line, use ? or * to match one or more characters in a filename:
file?.pdf stamps any file named file + any single character + .pdf
$./stamppdf StampItems1.txt Sample?.pdf
*.pdf stamps any file in the current working directory with the .pdf extension:
$./stamppdf StampItems1.txt *.pdf
Sample* stamps any PDF file in the current working directory that starts with “Sample” in the filename:
$./stamppdf StampItems1.txt Sample*
* stamps any PDF file in the current working directory:
$./stamppdf StampItems1.txt *
Note: StampPDF Batch will fail if it tries to stamp a file that is not a PDF document. We recommend always using .pdf in file specifications (the first two examples). If you leave out the .pdf extension, make sure the working directory contains only PDF files.
Running StampPDF Batch with PHP
StampPDF Batch can easily be run from user-written php code using the AppligentStampPDF Class. The class is a “wrapper” function, packaged to allow the PHP developer to easily run StampPDF Batch from any PHP script.
Examples
In this section we examine some of the samples in the StampPDF Batch Samples subdirectory. Stamp Files describes the stamp file LetterStamp.txt in detail.
Stamping company information on a business letter
Find lettersample.pdf in the Samples subdirectory. This example uses the stamp file letterstamp.txt to stamp lettersample.pdf.
The sample document lettersample.pdf is a single page business letter. With letterstamp.txt, StampPDF Batch applies the following stamps:
- A header with the Appligent, Inc. company logo
- A PDF file containing the Appligent return address
- The current date
- A watermark of “Confidential” across the page
- An image of a signature
- A disclaimer in a multi-line footer
Note: In the following examples, we use relative path names for clarity. We recommend using full path names at all times.
To stamp the lettersample.pdf file:
Change your working directory to the StampPDF Batch directory. The stamp file letterstamp.txt uses relative paths from here for the image files. It will fail if you do not run from this directory.
The default location for StampPDF Batch on Windows is:
>C:\Appligent\StampPDFBatch
On other platforms, it will be wherever you installed it.
Enter the following command (UNIX and Mac OS X):
$./stamppdf -o ./samples/letterout.pdf ./samples/letterstamp.txt ./samples/lettersample.pdf
or in Windows:
>stamppdf -o .\samples\letterout.pdf .\samples\letterstamp.txt .\samples\lettersample.pdf
Open ./Samples/letterout.pdf and ./Samples/lettersample.pdf in Acrobat or Acrobat Reader and compare them to see the stamps applied.
Close both files when you are finished.
Removing a stamp
Use the -u <UndoLabel> command to remove a stamp from a document. In letterstamp.txt, the Signature stamp has an UndoLabel called undoStamp.
To remove the Signature stamp:
Make sure you are still in the StampPDF Batch working directory.
Enter the following command (UNIX and Mac OS X):
$./stamppdf -u undoStamp ./samples/letterout.pdf
or in Windows
>stamppdf -u undoStamp .\samples\letterout.pdf
Open ./samples/letterout.pdf in Acrobat or Acrobat Reader and verify that the signature image has been removed.
Close the file when you are finished.
Running the other samples
StampPDF Batch includes these other samples:
- sample1.pdf and stampitems1.txt
- sample2.pdf and stampitems2.txt
- CJK_stamp.utx, which stamps Japanese characters using UTF-8 and UTF-16, if you have support for Unicode installed. Use this stamp file with any PDF file.
These samples demonstrate many features available in StampPDF Batch. Run them to see what StampPDF Batch can do.
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
The -vars parameter allow 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.
Command Collections – High performance Operations
The -cmds option allows you to process a collection of files at one time
To process multiple commands quickly and efficiently, use the -cmds <filename> option. The file specified by -cmds, the commands file, should contain one or more single line commands. Each command is just like an ordinary command-line without the executable name. The commands file does not support wildcards in filenames. The following is an example of command line syntax when running with -cmds:
$ ./stamppdfapp -p -l logfile.txt -cmds CommandFile.txt
CommandFile.txt contains a list of commands for StampPDF Batch to process. This is an example of the CommandFile.txt:
-p -iso32000 /appligent/stampbatch/samples/stampfile1.txt -o /appligent/stampbatch/samples/out_sample1.pdf /appligent/stampbatch/samples/sample1.pdf
-p -optimize /appligent/stampbatch/samples/stampfile2.txt -o /appligent/stampbatch/samples/out_sample2.pdf /appligent/stampbatch/samples/sample2.pdf
-p -w /appligent/stampbatch/samples/stampfile3.txt -o /appligent/stampbatch/samples/out_sample3.pdf /appligent/stampbatch/samples/sample3.pdf
Applying Standard Security
Acrobat Standard Security
Acrobat standard security allows you to control who can access your document and, by setting permissions, how much they can edit or print. Acrobat offers three levels of security:
- Low-level encryption (40-bit key length) — Compatible with Acrobat versions 3 and later.
- High-level encryption (128-bit key length) — Compatible with Acrobat versions 5 and later.
- AES encryption (128-bit key length) — Available only with Acrobat 8 and later.
- AES encryption (256-bit key length — available for SecurSign & APCrypt only) — Available only with Acrobat X, XI and DC.
High level encryption provides a higher level of security and finer control over security features. The minimum level of security that you can set is to allow any changes except extracting pages.
Once you set encryption on a document, it cannot be processed in other ways unless the password is available to the processing software. You can also change or remove encryption in Acrobat.
Owner and user passwords
All levels of security allow you to set passwords for the document:
- User password: controls who may view a document.
- Owner password (required): controls who may make changes to permissions and passwords securing a document.
You must set an Owner password to apply encryption. Do not use the same password for both User and Owner. If the same password is used for both, only the User password will be set.
Different versions of Acrobat use different terminology to refer to the same concepts. You’ll see more of this in High-level encryption password nomenclature as described in the following table for various versions of Adobe Acrobat:
Type | Acrobat X, XI & DC |
---|---|
User | Document Open |
Owner | Change Permissions |
Encryption Permissions
Acrobat allows you to set various permissions to limit access to the information in the document. Adobe changes the use of permissions when they moved from 40-bit key lengths to 128-bit key lengths. The sections below detail the different options and permissions based on using 40-bit or 128/256 bit key lengths.
The following is an example of the security options in Acrobat X, XI & DC:
Refer to Verifying Security Features for instructions on displaying the security options.
Encryption options
The table below describes low-level encryption options.
High level encryption provides additional security options as are defined in the table below.
Type | Option | Parameter | Description |
---|---|---|---|
Encryption | -encrypt | Encrypt using the RC4 stream cypher (same as -rc4) | |
-aes | Encrypt using the Advanced Encryption Standard (AES) algorithm (SecurSign & APCrypt) | ||
-rc4 | Encrypt using the RC4 stream cypher | ||
-keylength | 128 | Key length. Valid options are 40, 128 or 256. Default is 128. (256 bit – SecurSign & APCrypt Only) | |
-ownerpass | oPassword | New owner password (required) | |
-userpass | uPassword | New user password | |
-onlyattach | Encrypt document attachments only using AES; to use the PDFas a secure envelope for the attachments (requires -userpass) (SecurSign Only) | ||
-remove | Remove all encryption from the PDF document. (Requires -ownerpass) | ||
-d | Password | Old owner password – (Except AppendPDF & AppendPDF Pro) | |
Permissions | -noaccess | Do not allow accessibility (128 & 256) – (256 bit – SecurSign & APCrypt Only) | |
-nocopy | Do not allow copying text or graphics | ||
-noprint | Do not allow printing | ||
-nohighres | Do not allow high resolution printing (128 & 256) – (256 bit – SecurSign & APCrypt Only) | ||
-nomodify | Do not allow modifying the document | ||
-nonotes | Do not allow adding or changing notes or form fields | ||
-nofill | Do not allow filling in form fields or signing (128 & 256) – (256 bit – SecurSign & APCrypt Only) | ||
-noassembly | Do not allow document assembly (128 & 256) – (256 bit – SecurSign & APCrypt Only) |
The first four permissions can be used in any combination, except you can’t use -noprint and -nohighres together. Choose one or the other. The last four must be used in specific combinations that Acrobat accepts.
-encrypt — Encrypt output file (optional)
Specifies applying encryption to the output file using the RC4 stream cypher. This option is the same as -rc4.
-aes — Encrypt using the AES cryptography algorithm (optional) (SecurSign & APCrypt Only)
Encrypt the output file using the Advanced Encryption Standard (AES) cryptography algorithm.
-rc4 — Encrypt using the RC4 cryptography algorithm (optional)
Specifies applying encryption to the output file.
-keylength <int> — Encryption level (optional)
Specifies the encryption key length used to encrypt the document: either 40-bit, 128-bit or 256-bit. (256- bit SecurSign & APCrypt Only)
If you do not specify key length, the default is 128-bit.
-ownerpass <password> — New owner password (required)
Specifies a new Owner password to apply encryption. An Owner password restricts you from altering the security settings. You are not prompted for a password to open the document, only if you try to change the security settings. Passwords are case sensitive and are required when applying encryption.
Choose passwords carefully. They should not be able to be guessed easily but at the same time should not be too difficult for you to remember. If you forget a password, there is no way to recover it from the document. Therefore, it is a good idea to note passwords in another secure location.
-userpass <password> — Set user password (optional)
Specifies a User password for the document. Setting a User password prevents a document from being opened unless the correct password is supplied. Passwords are case sensitive.
Below is the Document Open Password dialog box.
When someone tries to open the document in Acrobat they will be asked for the password.
User password is optional. If you do not specify a User password, anyone can open the document.
-onlyattach — Secure Envelope(optional) (SecurSign Only)
Utilize PDFs as secure envelopes; apply 256-bit AES security to PDF and non-PDF file attachments while leaving the PDF itself unencrypted.
-remove — Remove all encryption from the PDF document
Removing encryption from the PDF document requires the document owner password using -ownerpass.
-d <string> — Old owner password to decrypt the file (Not available for AppendPDF & AppendPDF Pro)
If a PDF file already has encryption set and you wish to change the settings or remove encryption (APCrypt/SecurSign only), you need to supply the owner password in order to make changes to the file.
Document Permissions
-noprint — Do not allow printing (optional)
Specifies that the document cannot be printed. When the document is opened, the print icon on the toolbar and the Print option under the file menu will be grayed out.
At the 128-bit and 256-bit encryption level there is also an option to allow low resolution printing only. See the section High-level encryption for more detail.
-nomodify — Do not allow modifying the document (optional)
Specifies that the document cannot be modified. You will not be able to modify text or pages in the document when this option is used. You can fill in form fields, or add notes or other annotations.
With -nomodify, the following tools are grayed out and cannot be used when the document is opened in Acrobat:
- Crop tool
- Movie tool
- Link tool
- Article tool
- Form tool
- Digital Signature tool
Text can be selected for copying but cannot be cut, pasted or cleared.
-nocopy — Do not allow copying text or graphics (optional)
Specifies text and graphics cannot be copied.
With -nocopy, the following tools are grayed out and cannot be used when the document is opened in Acrobat:
- Text Select tool
- Touch-Up Text tool
- Table/Formatted Text Select tool
-nonotes — Do not allow adding or changing notes or form fields (optional)
Specifies that annotations cannot be added or changed in the document. Annotations include notes, highlighted text, form fields and pencil marks. Annotations can be in text, graphic or audio format, or even attached external files.
With -nonotes, the following tools are grayed out and cannot be used when the document is opened in Acrobat:
- Notes tool
- Pencil tool
- Highlight Text tool
- Form tool
- Digital Signature tool
- Free Text tool
- Sound Attachment tool
- Stamp tool
- File Attachment
- Square tool
- Circle tool
- Line tool
-noaccess — Do not allow accessibility (optional)
Specifies content accessibility is not allowed. Content accessibility provides the vision and motion-challenged community with the tools and resources to make digital information more accessible. To learn more about content accessibility consult the Acrobat Help guide within Acrobat.
-nohighres — Do not allow high resolution printing (optional)
Specifies low resolution printing only. Acrobat prints each page as a low resolution (150 dpi) bitmap. The document cannot be recreated from these printouts.
-nofill — Do not allow filling form fields or signing fields
Specifies that no changes can be made to form fields or digital signature fields. This setting effectively prevents a filled-in form from being changed.
-noassembly — Do not allow document assembly
Specifies that no new pages can be added or removed from the PDF document. Also prevents rotating pages in the document. Effectively prevents pages being removed from the PDF document to be used elsewhere.
Permissions Allowed with 40-bit Encyption
The table below shows how the software application security options correspond to Acrobat’s security restrictions. The “Changes Allowed” column below lists the features still available after the document is secured.
Option | Restrictions Set (Not Allowed) |
Changes Allowed |
---|---|---|
-nocopy | Content Copying or Extraction Content Accessibility |
|
-noprint | Printing | |
-nomodify -nonotes |
Changing the Document Document Assembly Authoring Comments and Form Fields Form Field Fill-in or Signing |
None |
-nomodify | Changing the Document Document Assembly |
Commenting, filling in form fields, and signing |
-nonotes | Authoring Comments and Form Fields | Page layout, filling in form fields, and signing |
none | Any except extracting pages |
Permissions Allowed with 128-bit or 256-bit Encryption
Acrobat accepts certain combinations of the “Changes Allowed” options. The Changes Allowed options are:
- -nomodify — Do Not Allow Modifying the Document
- -noassembly — Do Not Allow Document Assembly
- -nonotes — Do Not Allow Adding or Changing Notes or Form Fields
- -nofill — Do Not Allow Filling In or Signing of Form Fields
The table below shows security options vs. restrictions set with high level encryption. These combinations are discussed below.
Option | Restrictions Set (Not Allowed) |
---|---|
-noaccess | Content Accessibility |
-nocopy | Content Copying or Extraction |
-noprint | Printing |
-nohighres | Only Low Resolution Printing is allowed |
-nomodify -nonotes -nofill -noassembly |
Changing the Document Authoring Comments and Form Fields Form Field Fill-in or Signing Document Assembly |
-nomodify -nonotes -nofill |
Changing the Document Authoring Comments and Form Fields Form Field Fill-in or Signing |
-nomodify -nonotes -noassembly |
Changing the Document Authoring Comments and Form Fields Document Assembly |
-nomodify -noassembly |
Changing the Document Document Assembly |
none |
Allow no changes with -nomodify -noassembly -nonotes -nofill
Turning off all changes means: do not allow document modification (-nomodify), do not allow document assembly (-noassembly), do not allow the adding or changing of notes or form fields (-nonotes) and do not allow the fill-in or signing of form fields (-nofill). These options must all be used together for this setting to be made.
Allow inserting, deleting, and rotating pages with -nomodify -nonotes -nofill
This setting only allows document assembly.
These options specify: do not allow document modification (-nomodify), do not allow the adding or changing of notes or form fields (-nonotes) and do not allow the fill-in or signing of form fields (-nofill).
Allow filling in form fields, and signing with -nomodify -noassembly -nonotes
This setting only allows form field fill-in or signing.
These options specify: do not allow document modification (-nomodify), do not allow document assembly (-noassembly), and do not allow the adding or changing of notes or form fields (-nonotes).
Allow commenting, filling in form fields, and signing with -nomodify -noassembly
This setting allows the adding or changing of notes or form fields and the fill-in or signing of form fields.
These options specify: do not allow document modification (-nomodify), and do not allow document assembly (-noassembly).
Allow any except extracting pages with no options
If you don’t use any Changes Allowed options, Acrobat will allow any changes except extracting pages.
Verifying Security Features
To view the current security settings:
Acrobat X, XI and DC | Select File > Properties. Click the Security tab, then click the Show Details… button. |
---|
In the example shown below, both a User password and an Owner password are set, only low resolution printing is allowed, changing the document, content copying and extraction, authoring comments and form fields, and form field fill-in or signing are not allowed, content accessibility and document assembly are allowed and encryption is 128-bit.
Extending StampPDF Batch
Sample Scripts
We make sample ASP, Perl, Java, PHP and Visual Basic scripts available for you to review on our web site. The scripts are written for FDFMerge, but can be easily translated for use with StampPDF Batch. The scripts can be found on the Appligent website.
How a Date/Time Stamp Script Might Work
The following steps briefly summarize how you might use a script to stamp the date and time on a PDF document a user downloads from your web site:
- A user requests a document
- The Perl CGI module prints a HTML header
- The script opens and writes parameters and values to a text file, stampfile.txt, that contains the following information:
— page margins
— pages to stamp
— text size and color
— date and time variables
— date/time stamp position - The resulting stamp file shown in the figure below stamps the current date and time formatted as “Sept 1, 2007 12:30:01” and positions it at the top right of the first page in the PDF document.
The stamp file below stamps the current date and time in a document:
# — Options — | Comment |
Begin_Options | Begin Options Block |
Version (2) | Stamp file format version 2 |
TopMargin (2) | Top Margin |
BottomMargin (2) | Bottom Margin |
LeftMargin (8) | Left Margin |
RightMargin (8) | Right Margin |
End_Options | End Options |
# — Stamp Item — | Comment |
Begin_Messge | Begin Stamp Item |
Name (Demo Item1) | Named Demo Item 1 |
StartPage (1) | Start on first page |
EndPage (1) | Stamp to the first page (stamp only first page) |
Size (10) | Font Size 10 points |
Gray (0) | Black text |
Text (%b %d, %Y %X) | Insert month name, day, year with century and local time |
Position (top) | Position the top of the text along the top margin |
Justification (right) | Right justify the text |
Underlay (no) | Stamp on top of existing text and graphics |
End_Message | End Stamp Item |
The values entered for the Text parameter (%b %d, %Y %X) automatically stamp the current date and time on a document. It is unnecessary for you to retrieve the system date. You may use variables to create a date and time stamp in a variety of formats. For more information, refer to Using variables in stamp files.
The figure below shows an example of a flowchart for an automated CGI script for StampPDF Batch.
The example flow of the script shown in the figure runs StampPDF Batch with the -o <output file> option so that it creates a new output file and does not overwrite the original file. The new PDF document is stamped with the current date and time in the upper right corner of the first page.
HTML and JavaScript code can be used in the Perl script to return the stamped file to the user’s browser.
Stamping PDF documents using Perl code
Below are example commands for using a Perl script to run StampPDF Batch.
Scripting the StampPDF Batch command in UNIX
"/usr/local/share/stamppdfapp ", "/usr/local/share/stampdemo.txt", "/usr/local/share/stampdemo.pdf";
This is a sample command. Your flavor of UNIX may require a slight variation.
Scripting the StampPDF Batch command in Windows NT
"c:\\stamppdfapp.exe c:\\stamptext c:\\sample.pdf";
Considering date/time stamp applications
To stamp documents once a day or once a week, you may set up your system to run a Perl script automatically. For example, to create a new stamped PDF document on a UNIX system, you might use cron to run the script on a specific date at a specific time.
Introduction to the Command Line
Windows
To run StampPDF Batch in Windows, you need to open a Command Prompt window.
In Windows XP, Vista or 7:
- Click Start > Programs > Accessories > Command Prompt
The Command Prompt window opens.
Some basic commands
At the command prompt, you type each command, and press the Enter key to execute it. You can use the mouse to select text to copy or cut to the clipboard, but you cannot position the cursor with it. The command line is completely keyboard driven. Navigation keys are shown below:
Key | Action |
---|---|
Backspace | Delete previous character |
Right arrow | Move right one character |
Left arrow | Move left one character |
Up arrow | Recall previous command |
Tab | File or directory name auto complete |
Enter | Execute command |
In addition to running programs, you have many commands to navigate and maintain the system. Two important ones are cd and dir.
Changing directories
Use the cd command to change directories. For example, to change to the directory that StampPDF Batch is located in, type:
C:\>cd \appligent\StampPDFBatch\
The command prompt changes to:
C:\Appligent\StampPDFBatch>
to show you where you are.
To move back one level, use the shortcut of two periods (..)
C:\Appligent\StampPDFBatch>cd..
Don’t forget to press the Enter key after every command. You will now be in this directory:
C:\Appligent>
Move back to StampPDFBatch:
C:\Appligent>cd StampPDFBatch
Listing the contents of a directory
Use the dir command to list the contents of a directory:
C:\Appligent\StampPDFBatch>dir
The computer responds with a listing of all the contents of the StampPDFBatch directory.
If the directory contents fly by too fast to read, do this:
C:\Appligent\StampPDFBatch>dir /p
The /p switch tells DOS to display one page at a time. Press the Enter key to see the next page.
To see the contents of all the subdirectories at the same time, type:
C:\Appligent\StampPDFBatch>dir /s
This displays the contents of StampPDFBatch and all the subdirectories under it.
Running StampPDF Batch
To run StampPDF Batch, type the commands on the command line as shown in other sections of this manual and press Enter. In the next example, we’ve truncated the command prompt path for clarity.
>stamppdf -o \path\samples\letterout.pdf \path\samples\letterstamp.txt \path\samples\letterstamp.pdf
The letterstamp.txt file contains the stamp item parameters to stamp the PDF document. Refer to the rest of this User Guide for details about using StampPDF Batch.
Troubleshooting
Common Problems
Before proceeding, if you are having problems with your PDF files, check that they are well-formed, and not corrupt. See Cleaning up PDF Documents below.
- If you have encrypted files, you must pass the Owner Password to StampPDF Batch to stamp them. You provide the Owner Password with the -d <owner password> command line option.
- The name of the stamp file must precede the name of the PDF document to be stamped on the command line. The stamp file will generally have a .txt extension and the PDF document will have a .pdf extension. StampPDF Batch will not work properly if the PDF document name precedes the stamp file on the command line.
- When using the log file option, -l <logfile>, there must be a log file name. If there is no file name, StampPDF Batch will recognize the text string immediately following the -l as the name of the log file, which may cause an unintended result.
- When using the output file option, -o <outfile>, be sure to have an output file name. If the -o is used without an accompanying filename, StampPDF Batch will use whatever text string that follows as the name for the output file, again causing an unexpected result.
- Make sure all file and path names are correct. If you are working in one directory and StampPDF Batch resides in another, you must account for that in your stamp file and command line. We recommend that you always use full paths to all files used in your stamp files as well as to the input, output, and log files.
- If you get an error from StampPDF Batch that the file was unable to write, check to make sure that the file isn’t open in Adobe Acrobat or any other application. Also be sure the file is not set as read-only or encrypted.
- StampPDF Batch only stamps PDF documents. Any attempt to stamp a file that is not PDF will fail. Be aware of this if you are using wildcards to specify filenames.
- Be aware of “special characters” that may cause problems with filenames and names for the UndoLabel. Avoid use of the following characters when naming log files, output files or UndoLabels for undoing stamps: \ / : * ? ” < > | ^ &.
Cleaning Up PDF Documents
Not all PDF files are created equal. The way in which a PDF document is generated makes a difference, and PDFs generated by third party tools in particular can vary in quality. PDF documents can also become corrupted.
To check how the file was created:
- In Acrobat X, XI and DC select File > Properties… and click Description. Under Advanced, look at PDF Producer.
If the PDF Producer field is blank, consider the file suspect.
Making a Clean PDF
If you are having problems with a specific PDF, try to create “clean” version of your document. There are two ways of doing this using Adobe Acrobat. If you use other PDF manipulation software, check the documentation for functions that may be equivalent to those found in Adobe Acrobat.
Method 1: “Optimize” your PDF
- In Acrobat X, XI and DC > File Menu > Save As > Optimized PDF
If saving as optimized does not work, distill the document by following the steps below.
Method 2: Distilling PDF Documents
Distilling a document will remove all comments and form-fields from the PDF. If the PDF contains these items and you wish to preserve them, you must save them before Distilling.
To save existing comments
- In Acrobat X, XI and DC select Comments > Comments List > click the Options icon > Export All to Data File… In the Export Comments dialog box, select a name and location for the Forms Data File (.fdf), and click Save.
See the additional step below for saving form fields (if any):
Delete all comments:
- In Acrobat X, XI and DC select all the comments in the Comments List pane and press the Delete key.
To save form fields (if any):
- Save a copy of the original file. You will copy and paste the form fields from the original file into the new file after the distilling procedure.
Distilling the document
To distill a PDF document do the following:
- In Acrobat X and XI select File > Save As > More Options > PostScript. Choose a name and location for the file and click Save.
- In Acrobat DC select File > Export to > PostScript. Choose a name and location for the file and click Save
- Open Acrobat Distiller > select File > Open… In the Open PostScript File dialog, locate the PostScript file created in the previous step and click Open.
The distiller will create a new PDF file with the same name and location as the PostScript file.
Restoring comments
To restore the comments:
- In Acrobat X and XI, select Comments > Comments List > click the Options icon > Import Data File… In the Import Comments dialog box, locate the Forms Data File (.fdf) previously saved and click Select. In the next pop-up box, click Yes. The comments are restored.
- In Acrobat DC, select Tools > Comments > Comments List > click the Options icon > Import Data File…In the Import Comments dialog box, locate the Forms Data File (.fdf) previously saved and click Select. In the next pop-up box, click yes. The comments are restored
Restoring form fields
To restore form fields:
- Open the original PDF file that includes form fields.
- In Acrobat X and XI select Tools > Forms > Edit Form)
- In Acrobat DC > select Tools > Prepare Form > Form fields will automatically appear
- The form fields will appear, do a Control-A to select all the form fields.
- Open the new distilled PDF file which has no form fields.
- Do a Control-V to paste all the form fields onto the page.
You may need to reposition the fields by selecting them again with the Select Object Tool and moving them to the correct position. For multi-page forms you must do this for each page separately.
Support
Telephone & Fax
- Telephone: +1 610 284 4006
- Fax: +1 610 284 4233
A member of our friendly, knowledgeable support staff will reply as soon as possible, generally within one business day.
International Support
Customers from locations outside the United States, including Germany, United Kingdom, Canada and Australia can contact us directly or connect with one of our many resellers.
When contacting support please provide the following information:
- Name of the Product
- Product Version Number
- Operating System
- Your Name
- Company Name
- Your Email Address
- Your Phone Number
- Product Registration Number
- Any files to help us reproduce your problem (if needed)
Running StampPDF Batch via PHP
Introduction to StampPDF Batch via PHP
StampPDF Batch can easily be run from user-written php code using the AppligentStampPDF Class. (.ZIP download includes all available Appligent PHP classes and sample code).
The class is freely available to any trial or licensed user of StampPDF Batch.
This page documents the class, and is updated as the StampPDF Batch application is updated.
How to call StampPDF Batch with PHP
The AppligentStampPDF class is a “wrapper” function, packaged to allow the PHP developer to easily run StampPDF Batch from any PHP script.
Here’s an example PHP script including the AppligentStampPDF class:
<?php
error_reporting(E_ALL);
ini_set('display_errors',true);
require_once('AppligentStampPDF.php');
//
//this a sample code to demonstrate how to
//use the AppligentStampPDF class
//
//instantiate an instance of the PhpStamp class
$myStamper = new AppligentStampPDF();
//specify the path to the StampPDF application
$myStamper->SetApplicationPath('./');
//specify parameters to be passed to the application
$myStamper->SetStampFile('stampfile.txt');
$myStamper->SetInputFile('infile.pdf');
$myStamper->SetOutputFile('outfile.pdf');
$myStamper->SetLogFile('log.txt');
$myStamper->SetShowProgress(true);
$myStamper->SetNoPrint(true);
$myStamper->SetEncrypt(true);
$myStamper->SetNewOwnerPass('me');
$myStamper->SetNewUserPass('you');
//enable the line below to examine the command line
//$myStamper->SetDebugMode(true);
//run StampPDF Batch
$appRet = $myStamper->Run($appOutput);
//output information about the run
if ($appRet == 0)
print "success\n";
else
print "failure\n";
print "application output:\n";
print_r($appOutput);
?>
To use the AppligentStampPDF class functions, one must first indicate that the class is to be included in the current module; we perform this with the require_once statement:
require_once('AppligentStampPDF');
Next we instantiate the AppligentStampPDF class with php’s new function:
$myStamper = new AppligentStampPDF();
AppligentStampPDF Methods Overview
The AppligentStampPDF object needs information about what needs to be done. There are several built in methods of the class listed in the following table. A detailed description of each method follows the table.
Process Options (details)
Method | Function | Required |
---|---|---|
SetStampFile | Specify the text stamp file | Yes* |
SetRemoveOldStamps | Remove stamps with UndoLabel | No |
SetBatesCharCount | Specify number of characters in Bates numbers | No |
* – SetStampFile is mutually-exclusive with SetRemoveOldStamps
Security Options (details)
Method | Function | Required |
---|---|---|
SetEncrypt | Encrypt output file | No |
SetKeylength | Specify key length | No |
SetNewOwnerPass | Specify new owner password | No |
SetNewUserPass | Specify new user password | No |
SetNoPrint | Do Not Allow Printing | No |
SetNoModify | Do Not Allow Modifying the Document | No |
SetNoCopy | Do Not Allow Copying text or graphics | No |
SetNoNotes | Do Not Allow Adding or changing notes or form fields | No |
SetNoFill | Do Not Allow Fill or Sign of Form Fields | No |
SetNoAccess | Do Not Allow Accessibility | No |
SetNoAssembly | Do Not Allow Document Assembly | No |
SetNoHighRes | Do Not Allow High Resolution Printing | No |
General Options (details)
Method | Function | Required |
---|---|---|
SetApplicationPath | Specify the location of the StampPDF Batch product. | Yes |
SetInputFile | Specify the input pdf document | Yes |
SetOutputFile | Specify the output pdf document | Yes |
Run | Run the StampPDF Batch application with the parameters provided | Yes |
SetOwnerPass | Specify owner password to open this document | No |
SetIncrementalSave | Save using an incremental save | No |
SetLinearize | Linearize to support byte serving across the web | No |
SetOptimize | Optimize the output file to try to reduce file size | No |
SetNocomp | Do not compress using Object Streams | No |
SetComp | Compress using Object Streams | No |
SetIso32000 | Set file for ISO 32000 compliance | No |
SetLicenseCode | Specify the license code for StampPDF Batch | No** |
SetLogFile | Specify the log file | No |
SetOptionalCmds | Pass command-line style optional commands to object | No |
SetDebugMode | Enable debugging features | No |
SetShowProgress | Show progress information | No |
SetShowVersion | Show application version | No |
SetCommandLine | Pass entire command line to object. | No |
** – This method is not required if StampPDF Batch has been installed using the standard installation mechanism (as of version 5.0).
AppligentStampPDF Method Descriptions
Process Options
SetStampFile
Specify the stamp file, a text file that specifies how stamps are to be applied to your document. Stamp files include two main components; an options block specifying general stamp properties and one or more stamp items that contain parameters describing a particular stamp.
Syntax:
void SetStampFile(string $path-to-stamp-file)
Returns: nothing
Example:
$myStamper->SetStampFile('stampfile.txt');
SetRemoveOldStamps
Remove old stamps with UndoLabel
Syntax:
void SetRemoveOldStamps(string $undo-label)
Returns: nothing
Example:
$myStamper->SetRemoveOldStamps('undo_label');
SetBatesCharCount
Specify number of characters in Bates numbers
Syntax:
void SetBatesCharCount(int $num-chars)
Returns: nothing
Example:
$myStamper->SetBatesCharCount(4);
Security Options
SetEncrypt
Encrypt output file using standard Acrobat security.
Syntax:
void SetEncrypt(bool $flag)
Returns: nothing
Example:
$myStamper->SetEncrypt(true);
SetKeylength
Specify encryption key length. Valid options are 40 and 128. Default is 128.
Syntax:
void SetKeylength(int $keylen)
Returns: nothing
Example:
$myStamper->SetKeylength(128);
SetNewOwnerPass
Specify new owner password
Syntax:
void SetNewOwnerPass(string $ownerPass)
Returns: nothing
Example:
$myStamper->SetNewOwnerPass('ownerpass');
SetNewUserPass
Specify new user password
Syntax:
void SetNewUserPass(string $userPass)
Returns: nothing
Example:
$myStamper->SetNewUserPass('userpass');
SetNoPrint
Do not allow printing
Syntax:
void SetNoPrint(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoPrint(true);
SetNoModify
Do not allow modifying the document
Syntax:
void SetNoModify(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoModify(true);
SetNoCopy
Do not allow copying text or graphics
Syntax:
void SetNoCopy(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoCopy(true);
SetNoNotes
Do not allow adding or changing notes or form fields
Syntax:
void SetNoNotes(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoNotes(true);
SetNoFill
Do not allow fill or sign of form fields
Syntax:
void SetNoFill(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoFill(true);
SetNoAccess
Do not allow accessibility
Syntax:
void SetNoAccess(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoAccess(true);
SetNoAssembly
Do not allow document assembly
Syntax:
void SetNoAssembly(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoAssembly(true);
SetNoHighRes
Do not allow high resolution printing
Syntax:
void SetNoHighRes(bool $flag)
Returns: nothing
Example:
$myStamper->SetNoHighRes(true);
General Options
SetApplicationPath
Specify the location of the StampPDF Batch product.
Syntax:
void SetApplicationPath(string $path-to-product)
Returns: Nothing
Example:
$myStamper->SetApplicationPath('/usr/local/bin/');
Note: The given string should be an absolute path to the product location, and must contain the trailing ‘/’ character.
SetInputFile
Specify the input pdf document
Syntax:
void SetInputFile(string $path-to-input-doc)
Returns: nothing
Example:
$myStamper->SetInputFile('infile.pdf');
SetOutputFile
Specify the output pdf document
Syntax:
void SetOutputFile(string $path-to-output-doc)
Returns: nothing
Example:
$myStamper->SetOutputFile('outfile.pdf');
Run
Run the StampPDF Batch application with the parameters previously provided
Syntax:
int Run($appOutput)
Parameters: $appOutput – an array created by the Run() method that, upon completion, will contain any messages generated by the application.
Returns: an integer value returned by the application to the command shell. A value of zero indicates normal execution of the product. A non-zero value means the application encountered errors during processing, in which case the $appOutput array will contain error messages and other relevant information.
Example:
$appRet = $myStamper->Run($appOutput);
if ($appRet == 0)
//successful completion
else
//an error occurred - the $appOutput array should be examined for details
SetOwnerPass
Specify owner password to open this document. This method is required when processing PDF files that have open password security enabled.
Syntax:
void SetOwnerPass(string $passwordStr)
Returns: nothing
Example:
$myStamper->SetOwnerPass('ownerpass');
SetIncrementalSave
Save using an incremental save. This method is faster, but results in a larger PDF file.
Syntax:
void SetIncrementalSave(bool $flag)
Returns: nothing
Example:
$myStamper->SetIncrementalSave(true);
SetLinearize
Linearize to support byte serving across the web. This function is also known as “Fast Web View”.
Syntax:
void SetLinearize(bool $flag)
Returns: nothing
Example:
$myStamper->SetLinearize(false);
SetOptimize
Optimize the output file to try to reduce file size.
Syntax:
void SetOptimize(bool $flag)
Returns: nothing
Example:
$myStamper->SetOptimize(true);
SetNocomp
Do not compress using Object Streams. (compatible with all versions of Adobe Acrobat and Reader)
Syntax:
void SetNocomp(bool $flag)
Returns: nothing
Example:
$myStamper->SetNocomp(true);
SetComp
Compress using Object Streams. (Output PDFs require Acrobat 6.x and later)
Syntax:
void SetComp(bool $flag)
Returns: nothing
Example:
$myStamper->SetComp(false);
SetIso32000
Set file for ISO 32000-1 compliance.
Syntax:
void SetIso32000(bool $flag)
Returns: nothing
Example:
$myStamper->SetIso32000(false);
SetLicenseCode
Specify the license code for StampPDF Batch. If the standard installation method (version 5.0 and later) has been used, this method is not required.
Syntax:
void SetLicenseCode(string $product-license-code)
Returns: nothing
Example:
$myStamper-> SetLicenseCode('xxxx-xxxx-xxxx-xxxx-xxxx-xxxx');
SetLogFile
Specify the log file
Syntax:
void SetLogFile(string $path-to-log-file)
Returns: nothing
Example:
$myStamper-> SetLogFile('logfile.txt');
SetOptionalCmds
Pass command-line style optional commands to object
Syntax:
void SetOptionalCmds(string $cmd-to-product)
Returns: nothing
Example:
$myStamper->SetOptionalCmds('-p -l logfile.txt');
SetDebugMode
Enable debugging features. When debug mode is enabled, rather than execute the StampPDF application, the Run() method, when called, will output the fully assembled command line to the terminal for examination.
Syntax:
void SetDebugMode(bool $mode);
Returns: nothing
Example:
$myStamper-> SetDebugMode(true);
SetShowProgress
Show progress information.
Syntax:
void SetShowProgress(bool $flag);
Returns: nothing
Example:
$myStamper->SetShowProgress(true);
SetShowVersion
Show application version
Syntax:
void SetShowVersion(bool $flag);
Returns: nothing
Example:
$myStamper-> SetShowVersion(true);
SetCommandLine
Pass entire command line to object. For those already familiar with the command line syntax of StampPDF Batch, this method allows the user to pass a command line into the object. Please refer to the description of the Run method above for more information.
Syntax:
void SetOptionalCmds(string $cmd-to-product)
Returns: nothing
Example:
$myStamper->SetOptionalCmds('-o outfile.pdf stampfile.txt infile.pdf');
$appRet = $myStamper->Run($appOutput);
StampPDF Batch Readme
New Features
StampPDF Batch 7.0
Barcode fonts are now supported for command line and built-in variables
New stamp file parameters:
New options for StartPage and EndPage
-1 represents the last page of the PDF file to be stamped. You can now use -2 for the second to the last page to be stamped, -3 for the third to the last page to be stamped and so on.
BarText – This parameter allows you to show or hide the text for barcode stamps. The default is to Show text. Options for this parameter are Show or Hide.
New command line options:
-vardelimiter – Delimiter character for variables in the stamp file (default is %)
-varfile: Text file that contains user defined variables and their value. This file is read instead of having to enter the variables and their value directly on the command line.
Example of how the varfile text file is setup:
Variable1, John Doe
Variables are setup in the stamp file using the Text parameter. Example:
Text (%Variable1%)
Command line: stamppdfapp -p -o outfile.pdf -varfile VariableText.txt StampFile.txt InputFile.pdf
StampPDF Batch 6.5
-vardelimiter: Delimiter character for variables in the stamp file (Default is %).
If you are using built-in variables and command line variables in the same stamp file, you need to use a different character other than the percent sign % to represent the command line variable in the stamp item. For example, stamp item should appear as:
Text (#First_Name# #Last_Name# %B %d %Y)
stamppdfapp -p -o out.pdf -vars “First_Name,Jane,Last_Name,Smith” -vardelimiter # StampFIle.txt Input.pdf
Support for 2D Barcodes
New parameters for stamp file:
Type (2DBarcode)
Code (DataMatrix)
The Scale parameter can be used to resize the stamped barcode.
PageTransform – New stamp item parameter that can scale and transform the page. This is used to reduce the size of the page and create white space at the top and right side of the page. This is useful for stamping text along the top and right edge of the page and ensuring the stamped text is not obscuring any of the page content.
PageTransform parameters are listed below:
Type (PageTransform)
PageScale (93) * This will scale the page to 93 percent of the original size
NOTE: The PageTransform stamp item must appear in after the Options block and before any other stamp items in the stamp file
Example:
Begin_Options | |
Version | (2.5) |
TopMargin | ( 30 ) |
BottomMargin | ( 30 ) |
LeftMargin | ( 30 ) |
RightMargin | ( 30 ) |
End_Options | |
# — Stamp Item | |
Begin_Message | |
Name | (Page Scale Sample) |
Type | (PageTransform) |
PageScale | (93) |
End_Message |
New values for the Position parameter in the stamp file:
(BottomUp-Left) – Draw text up from the bottom, on the left edge of the page
(BottomUp-Right) – Draw text up from the bottom, on the right edge of the page
(TopDown-Left) – Draw text down from the top, on the left edge of the page
(TopDown-Right) – Draw text down from the top, on the right edge of the page
StampPDF Batch 6.0
Please see the StampPDF Batch Options for the full documentation of the new features.
–sameversion — The output PDF file version will be the same as the input PDF file version.
–arabicfixedlength — The output Arabic text will have the same length as the input text
–vars — List of variables to be substituted in the Stamp File ( “name,value,name,value” )
StampPDF Batch now has the ability to dynamically replace variables found within the stamp file, and thus substitute the text that it stamps based on parameters set on the command line.
-watch: Path to watched folder directory
Activates the watch directory and executes the specified processing options when a document is dropped into the directory. All of the options can be used with the –watch option except –h, -help and -v
StampPDF Batch 5.3
AutoScale – This parameter will automatically scale your stamp to fit on the page without having to set any other options such as Page Margins. The value for AutoScale specifies the font size as a percentage of the larger dimension of the page size (ex. if your document is 8 1/2 x 11, with AutoScale set to (3), the stamp would be set at 3% of 11 inches. By using the AutoScale parameter in your stamp items, you will be able to apply the same stamp across multiple files regardless of their page size. You will not have to make any adjustments to margin settings.
StampPDF Batch 5.2
New Command Line Options:
-listfonts – display a list of the fonts available to StampPDF Batch
-listundo – list the undo labels present in a pdf file to stdout
-overwrite – New flag for overwriting the input file. The -overwrite flag is now required when overwriting an input file
-pdfa – Preserve PDF/A compatibility in a PDF/A compliant input file
New Parameters for stamp file
LinkURL (optional)
The LinkURL parameter specifies a URL link to be associated with a stamp. Example below:
LinkURL (/docs-stampbatch-stampfiles)
Encoding (required for Unicode fonts)
Unicode fonts require an encoding parameter. The encoding parameter should be set to the following values depending on the type of text used.
Encoding (UTF8)
The possible values for encoding are:
Encoding | |
Non-CJK Text | UTF8 |
Japanese Text | UniJIS-UTF16-H |
Korean Text | UniKS-UTF16-H |
Simplified Chinese Text | UniGB-UTF16-H |
Traditional Chinese Text | UniCNS-UTF16-H |
Font Support
Using Fonts:
Base14, OpenType, TrueType, Type1 and Unicode (see Encoding) fonts are all supported in StampPDF Batch. In previous versions, Type1 fonts were used in StampPDF Batch by including the FontFile parameter. In StampPDF Batch 5.2.2 and higher, you should only specify the font name.
In order to use a non-Base14 font, the font must be stored in one of the Appligent font directories (See Font Directories below). You can run the command
$ stamppdf –listfonts
to see a list of all font names available for stamping. The font name should be used exactly as it is shown in the font list.
Some of the classic Base14 fonts are no longer included with the application resources. In particular Times and Helvetica. Both of these fonts are automatically substituted; but, may not appear identical to the classic fonts. If the new font appearance are not accept-able; simply use the versions of Times and Helvetica available on your system. This can be done by setting the Font Directories; please see below.
Font Directories:
There are two font directories.
The default font directory is found under the AppligentHome directory in APDFLX.X.X/Resource/Font. On Windows, the AppligentHome directory is in the AllUsers Application data directory.
Windows 7 and later: C:\ProgramData\Appligent
Unix: /usr/local/appligent
You can also specify an additional font directory, the AP font directory. The path to the AP font directory is saved in an environment variable called AP_FONT_DIR. You will be prompted to enter a font directory during installation.
On Windows: Environment variables can be set on Windows under the System Properties. To display the System Properties, right click on “My Computer” and select properties. On the bottom of the Advanced tab, click the button labeled “Environment Variables”. Under system variables, you will see an entry for AP_FONT_DIR. Select this entry, and click edit. You can then change the
variable’s value to the path of the current font directory. Multiple directories can be added by placing a semicolon in between each directory path.
On Unix: As the other environment variables for StampPDF Batch, AP_FONT_DIR is set in the stamppdf script. The directory set in an environment variable in the script, or be set for the shell. See ManualInstall.pdf for more information on setting the AP_FONT_DIR and other environment variables on Unix.
FontFile (deprecated)
The FontFile parameter has been deprecated. To use a non-base14 font with StampPDF Batch, add the font to one of the font directories and specify the font name in the Stamp Item FontName ( ) parameter as specified in Using Fonts. Any FontFile parameter entries will be ignored. If you are currently using the FontFile parameter in any of your stamp files, check that the font name being used in the stamp item is correct. Previous versions of StampPDF Batch would allow the specified font file to override the FontName; currently the FontName has priority and FontFile is ignored.
StampPDF Batch 5.1
Version 5.1 adds the following new command line options:
–cmds — Command Collections allow you to process a collection of files at one time
To process multiple commands quickly and efficiently, use the -cmds option. The file specified by -cmds, the commands file, should contain one or more single line commands. Each command is just like an ordinary StampPDF Batch command-line without the executable name. The commands file does not support wildcards in filenames.
When you use the -cmds option, many of the StampPDF Batch options should be set in the -cmds file instead of on the command line. The following options are supported on the command line when using the -cmds option:
-r, -l, -n, -p
If the same option is set on the command line and in the a record of the -cmds file, the option value from the -cmds file record will be used.
For more information on the -cmds option, see Command Collections.
StampPDF Batch 5.0
For document optimization, use -optimize.
This flag reduces file size in most instances, and performs a variety of functions.
- encode any non-encoded streams using Flate compression
- remove ASCII85 filters from all streams
- replace LZW encoded streams with Flate encoding
- merge identical XObjects and images
- optimize common sequences in page content
- merge identical font descriptors and encodings
To maximize compression, use -comp.
This flag will apply object level compression, typically reducing file size by 2%.
Note: PDF files support the simultaneous use of multiple types of compression. Object level compression was developed by Adobe Systems to reduce the size of PDF files, with a typical reduction of 2%. The object level compression mechanism is not always understood by older versions of Acrobat or third party PDF software, and limits compatibility to Acrobat 6 or higher.
To not use object level compression, use -nocomp.
This flag will not add object level compression and will remove object level compression, if found, resulting in a document that is compatible with all versions of Acrobat.
To create an ISO 32000 compliant PDF, use -iso32000.
This flag sets the output file version for ISO 32000 compliance (Adobe PDF version 1.7).
StampPDF Batch 4.5
OffsetX and OffsetY parameters for text and image stamping. This parameter allows you to place text and images at very precise locations. The X and Y positions are defined in positive and negative points from the top left position of the stamp item.
StampPDF Batch 4.1.1
PageNumber parameter for PDF image stamping. This parameter specifies which page in the PDF file to use as the PDF stamp. Enter a page number or -1 to indicate the last page. If the page number entered is less than 1 but not -1, the first page is used. If the page number entered is greater than the last page number, the last page is used. The default is the first page of the PDF file.
CharSpace, WordSpace, and LineSpace parameters for Text Stamp Items. CharSpace adjusts character spacing, WordSpace adjusts word spacing, and LineSpace adjusts line spacing. Enter a positive real number with up to three digits following the decimal point. Numbers greater than 1 increase the spacing, and numbers less than 1 decrease the spacing.
Enhanced barcode support. StampPDF Batch includes built-in support for Code 128 character set B barcodes. StampPDF Batch automatically calculates the check character and places the start, check, and stop characters in the appropriate place. You only need to specify the data.
StampPDF Batch 4.0.8
BatesDigits parameter for Bates numbers. This parameter sets the number of digits in a Bates number. It overwrites the application default and value set on a command line with the -j option.
Ordinal suffix for dates. Code %D adds an ordinal number suffix (for example, “st” for first) to the day of the month: “1st”.
Known Issues
Unicode
Automatic word wrapping is not available for Unicode characters. You must manually insert line breaks and set the MultiLine parameter to Yes.
Variables (%x) are not supported.
General
If you are using the %i variable, be sure not to include any white space after Title, Author, and Subject. For example, use (%i(Title)) instead of (%i(Title )).
If an input PDF file has a user password set, this password will be copied over into the Stamp document, even if -userpass is not specified on the command line with -encrypt.
If a PDF file you are stamping is cropped, it may not stamp in the right location. You will need to remove the crop before stamping the pdf.
If you are stamping with the Symbol or Zapf Dingbats fonts, your stamps may not appear in the correct location.
There are some instances where the combination of the PDF source creation application and the printer driver draw a white rectangle behind the text of the page. This causes underlaid stamps to be obscured by the body of the document and underlaid stamped text to be obscured by images. The work-around is to use an overlaid stamp that is semi-transparent, uses an outline font, or both.
The %p variable, local equivalent of AM or PM, may not behave properly in all locales. When Regional Settings are changed to dd/mm/yy – dd MMMM yyyy (English, United Kingdom), nothing stamps where AM or PM should appear. However, this does work fine with the mm/dd/yy – dddd, MMMM dd, yyyy setting.
When diagonally stamping large text in the right or left position, the corners of letters may be cut off. To correct the problem, add a space at the beginning of the text, use the center position, or decrease the size of the text.
ASCII characters greater then 128 may not always stamp properly. Stamp files need to be generated on the same platform on which the StampPDF Batch application will run, because StampPDF Batch uses platform specific character encodings. For example, producing a stamp file on a Windows machine, then transferring that file to a UNIX computer to use with StampPDF Batch would result in the wrong character encoding being used and the wrong characters showing up in the output PDF file.
UNIX only
When the %P variable is used in the stamp file to stamp the “full directory path” of the document being stamped, the variable works correctly only when the full path or the input PDF document is given on the command line. If a relative path is given, only the relative path will be stamped.
There can be a problem with stamping high ASCII characters (accents, ®, ß, etc.) in a PDF document that includes a font that is not encoded (we saw the problem with Times). Make sure that all fonts are encoded in a document to ensure proper stamping.
To Get Help
Contact technical support by:
emailing support@appligent.com, or calling 610-284-4006
Please provide the following:
Product name and version number
Operating system
Your name, company name, email address, and phone number
Description of your question or problem
Responses are typically emailed within one business day.