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. AppendPDF Pro 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
%i<info field name> 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 first page only
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
ColorSpace (DeviceGray) Color of stamped text
Color (0) Black text
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 AppendPDF Pro 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 AppendPDF Pro 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. AppendPDF Pro will insert the leading zeros.

Bates stamp

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.


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

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, AppendPDF Pro begins stamping at the Bottom margin. To prevent your stamp from running off the page, increase the Bottom margin.

Multiline stamp

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:

Document Properties of a file

AppendPDF Pro 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, AppendPDF Pro won’t stamp any information for this variable.