Examples runs through the lettersample example, and lists the other samples included with 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.