AppendPDF Users Guide

Generate High Volumes of PDF Documents

Usage: appendpdf [options] paramFile1 [paramFile2 ...]]
Usage: appendpro [options] paramFile1 [paramFile2 ...]]

-b : Include bookmarks
-eb : Include embedded files
-extra : Include named destination links and bookmarks, article threads (recommended)

The Following parameters are available in AppendPDF Pro only

-f : Number from first page in output document
-u <string> : Remove old stamps with UndoLabel

-listfonts : Print list of available fonts in the appligent_home fonts folder

-portfolio <string> : Build Portfolio; options "icons" or "details", also called portable collections

-vars : List of variables to be substituted in the Cover, TOC, or Extras stamp File
Example variable list - ( "name,value,name,value" )
-vardelimiter : Delimiter character for variables in the Stamp File ( default is % )

Save Options

-i : Save using an incremental save
-w : Save as linearized pdf
-optimize : Optimize the output file to try to reduce file size
-nocomp : Do not compress using Object Streams; compatible with all versions of Acrobat
-comp : Compress using Object Streams; Acrobat 6 and later
-iso32000 : Set file for ISO 32000 compliance (PDF 1.7)
-o : Path to the output file or directory

Command List File

-cmds : Path to the file of commands -cmds only compatible with General Options

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

-v : Version information
-help : Help information
-h : Help information
-l : Log to a file
-p : Show progress information
-n : Show no information on the screen
-r <string> : Product registration code
Overview

AppendPDF and AppendPDF Pro provide a fast and efficient way to combine documents dynamically and on-demand. This documentation provides instructions for both AppendPDF and AppendPDF Pro. Content specific to AppendPDF Pro is followed by a notation: (AppendPDF Pro only).

With AppendPDF and AppendPDF Pro you can:

  • Combine documents
  • Combine page ranges and sections from a series of documents
  • Add Document Information
  • Generate a Table of Contents including corresponding PDF bookmarks (AppendPDF Pro only)
  • Add a Cover page (AppendPDF Pro only)
  • Stamp information onto the finished document — Add watermarks, copyright information, headers or footers to further customize your document delivery (AppendPDF Pro only)

The final presentation is professional and complete.

AppendPDF and AppendPDF Pro use a parameter file to build the new PDF file from lists of several PDF files or specific pages from those files. Two versions of parameter files are supported:

  • XML parameter files — Files coded in XML.
  • Text parameter files — Plain text parameter files.

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 examples:
    $appendpdfapp -r <Reg Number> -p -l <logfile.txt>
    $appendproapp -r <Reg Number> -p -l <logfile.txt>  (AppendPDF Pro only)
  • Cross Reference to other locations in the documentation: AppendPDF Pro. Click the colored text to go to the referenced link.
  • References to web sites for information: www.appligent.com. Click the colored text to open a browser to the website.
  • Code snippets: <appendparam version=’1.0′>
  • Content that is specific to AppendPDF Pro is followed by the notation: (AppendPDF Pro only).

You may see some paragraphs which look like the following:

Note: These paragraphs are special notes relating to the subject matter where they are located. It is recommended that you read all notes.

Note: For clarity, the examples in this User Guide use truncated path names. We recommend that you use full path names for all files.

Introduction

AppendPDF is a command-line-driven application that appends pages of one or many PDF documents to create one new document. AppendPDF is designed to run in tandem with other processes in an unattended environment and to handle high-volume and on-demand production needs.

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 this release, there are two additional environmental variables that need to be set for AppendPDF on all UNIX platforms. If you run AppendPDF from the appendpdf script created during installation, these environmental variables will be set by the script. If you run appendpdfapp directly, you will need to set these environmental variables to run AppendPDF. Once AppendPDF is installed, you can view the variables needed by looking at the appendpdf 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 AppendPDF. It also contains license information for AppendPDF.

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 AppendPDF

In previous versions of AppendPDF, the AppendPDF registration number was required as a command line option with the -r flag each time appendpdfapp was run. A appendpdf script was provided that automatically added -r and the registration number to the appendapp command line when the script was run.

In the current release, in addition to getting the registration number from the command line, AppendPDF 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.

Introduction

We will be using the sample parameter file paramsletter.xml in the samples directory as an example throughout this chapter. The default location for AppendPDF Pro on Windows is C:\Appligent\AppendPro\ and AppendPDF is located in C:\Appligent\AppendPDF. On other platforms, it will be wherever you installed it. The paramsletter.xml AppendPDF Pro example contains most of the features described in this chapter for the purpose of explanation and examples.

Note: AppendPDF does not have all the capabilities that are shown in the examples (Comparing AppendPDF Products provides an overview of the differences). Information that is specific to AppendPDF Pro will be followed by the notation: (AppendPDF Pro only).

What is a Parameter File?

AppendPDF and AppendPDF Pro require a parameter file to specify how you want to build a new document. This chapter explains XML parameter files, while Parameter Files — Text (AppendPDF Pro) and Parameter Files — Text (AppendPDF) describe text parameter files:

  • XML — the parameter files using XML to code parameter specifications.
  • Plain text — the text parameter files used by earlier releases of AppendPDF Pro and AppendPDF. These are supported to maintain backward compatibility with existing workflows. New features will only be available using XML files.

An XML parameter file is a text file containing the XML markup that specifies how AppendPDF Pro or AppendPDF will build your new document. You can specify the name of the output file, list the files to be included in the appended document and set many other options to establish how you want the final document to look when it is opened by the end user.

The parameter file includes:

  • <outputpdf> — Output File is the name (including directory path) of the new, appended file.
  • <sourcepdfs> — Source Files are the documents to be used for appending, including page ranges and Table of Contents entries.
  • <TOC> — Table of Contents information includes the table of contents file, alternate bookmark text, and the stamp file for the table of contents (AppendPDF Pro only).
  • <coverpage> — Cover page information includes the cover page file to be used and the stamp file for the cover page (AppendPDF Pro only).
  • <docinfo> — Document information is Title, Author, Subject, Keywords, and custom fields. These are viewable within Adobe Acrobat and Acrobat Reader.
  • <extras> — Extras specify additional information such as how the document should open or a stamp file for the body of the document.

Building a Parameter File

Elements and structure

We use XML to describe the parameters that AppendPDF Pro and AppendPDF uses to append documents together. As we describe XML elements, there are two sections:

  1. A tree view of the elements, which describes the elements and shows how they are related.
  2. Examples of XML code for each element.

Content of an element table

An element table contains the following information:

  • Element — The element tag.
  • Required — Whether the element is required (Green check mark) or optional (blank). If the child of an optional element is marked required, it is only required if the parent is used.
  • Content — what information the element contains, i.e., what it specifies. Note that an element can either contain data, or be empty. If it is empty, nothing else is needed.

Note: Empty element tags can be entered using the beginning and end tags together or by using a simpler tag placing the slash “/” after the tag name as shown below:
<tag></tag>
or
<tag/>

The element tree structure

All of the tables in the XML Parameter chapter that describe the structure of elements use notations and indents to indicate specific things about individual elements:

  • The element tree structure shows the topmost element as being expanded with child elements below.
  • The Level column indicates what level from the top parent element described in the table, the current child element resides.
  • The notation “+” indicates the element is collapsed and is a parent which contains child elements within its structure.
  • Indents are used to assist in understanding the structure levels of the elements in the table.
  • When there are elements that come before the current element in the <appendparam> structure, and they are not being shown, there will be a ⇔ symbol before the element tag name in the table.
  • Some parent elements contain several options. When only one of the options can be used at a time the word “OR” will appear before the element tag name in the table.

XML Parameter File Details

The XML parameter file contains content and design information for the document that will be built by AppendPDF Pro or AppendPDF. The following sub-chapters describe in detail how to build parameter files in XML format.

Introduction

The element <appendparam> specifies that this is an AppendPDF Pro or AppendPDF parameter file. It has one attribute, version, which should be 1.0. The table below describes the attributes of the element <appendparam>.

Content of the <appendparam> Element

Element Level Required Content
<appendparam version=”1.0″> Top

Green check mark

Topmost element, contains entire parameter spec
+ <outputpdf> 2 Green check mark The name of the new, appended file
+ <sourcepdfs> 2 Green check mark Input files to be appended
+ <docinfo> 2   Document information
+ <extras> 2   Modes for opening and displaying files

XML Code Sample

<appendparam version="1.0">
Insert parameter specifications here
</appendparam>

Introduction

The element <outputpdf> specifies the output file for the appended document. The following table lists all the elements and their attributes along with the tree view.

The table below describes the elements specifying <outputpdf>.

Contents of the <outputpdf> Element

Element Level Pro Required Content
<appendparam version=”1.0″> Top   Green check mark Topmost element, contains entire parameter spec
<outputpdf> 2   Green check mark The name of the new, appended file
<file> 3   Green check mark Text: Name and path of the new, appended file
+ <sourcepdfs> 2   Green check mark Input files to be appended
+ <docinfo> 2     Document information

XML Code Sample

To specify an output file, outputfile.pdf, insert the code:

<appendparam version="1.0">
<outputpdf>
<file>
/fullpath/outputfile.pdf
</file>
</outputpdf>
<!-- . Indicates skipped sections -->
<!-- . -->
<!-- . -->
</appendparam>

Element for <outputpdf>

file

Specifies the path and filename of the output, appended PDF file.

Introduction

The element <sourcepdfs> specifies the input files, page ranges, and Table of Contents entry text for the appended document. You can specify more than one input file. To specify multiple page ranges from one file, specify an inputpdf, using the same file, for each page range.

The table below describes the elements specifying <sourcepdfs>.

Contents of the <sourcepdfs> Element

Element Level Required Content
<appendparam version=”1.0″> Top Green check mark Topmost element, contains entire parameter spec
<sourcepdfs> 2 Green check mark Input files to be appended
<inputpdf> 3 Green check mark Input PDF file
<file> 4 Green check mark Text: Name and path of input file
<startpage> 4   Text: Start page of range to extract
<endpage> 4   Text: End page of range to extract
+ <inputpdf> 3   Additional PDF Files

XML Code Sample

Specifying an input file.

<appendparam version="1.0">
<!-- . Indicates skipped sections-->
<!-- . -->
<!-- . -->
<sourcepdfs>
<inputpdf>
<file>
/fullpath/input1.pdf
</file>
<startpage>
3
</startpage>
<endpage>
10
</endpage>
<TOCEntry>
Input File 1
</TOCEntry>
</inputpdf>
</sourcepdfs>
<!-- . -->
<!-- . -->
<!-- . -->
</appendparam>

Elements for <sourcepdfs>

inputpdf

Specifies the details of an input file.

You can specify more than one file by including multiple sets of <inputpdf> tags.

file

Specifies the path and filename of an input PDF file.

startpage, endpage

Specifies the start page and end page of a range of pages to extract and append to the output document. The example above will extract pages 3 through 10 of the input document.

Specifying page ranges

The following notes apply to specifying page ranges:

  • If you do not specify a page range, the entire file will be appended.
  • You can specify multiple page ranges by specifying the same file in multiple instances of <inputpdf>. For each instance, specify one of the required ranges in a <startpage> and <endpage> set.
  • To specify one page, make the value of <startpage> and <endpage> the same.
  • To specify from a particular page to the end of the file, use only the <startpage> tag.
  • You can specify the last page of a document using -1. This is especially helpful if the number of pages in a document may change.

TOCEntry (AppendPDF Pro only)

Specifies the text to use in the Table of Contents to identify this range of pages. <TOCEntry> is only used if you include a TOC page, see Table of Contents — XML. If you want to append an <inputpdf> without an entry in the Table of Contents, use an empty <TOCEntry> tag as shown below:

<TOCEntry/>

Note: If you are using a TOC page and do not include a <TOCEntry> element for an <inputpdf>, the Title in the Document Properties of the input file will be used as the TOC entry. If the file does not have a Title set, the file name of the <inputpdf> will be used.

Examples

For clarity, the following examples use truncated path names. We recommend that you use full path names for all files. The following examples are from the sample files included with AppendPDF Pro.

Including the entire file

To include the entire file, do not specify a page range:

<sourcepdfs>
<inputpdf>
<file>
./samples/pdfs/sample1.pdf
</file>
</inputpdf>
</sourcepdfs>

To explicitly specify all pages in a file and a TOC entry

<sourcepdfs>
<inputpdf>
<file>
./samples/pdfs/sample1.pdf
</file>
<startpage>
1
</startpage>
<endpage>
-1
</endpage>
<TOCEntry>
sample document 1
</TOCEntry>
</inputpdf>
</sourcepdfs>

Other examples

The following additional examples use a generic example file.

Including one page of a file

To include only page 7 of a file:

<sourcepdfs>
<inputpdf>
<file>
./samples/example.pdf
</file>
<startpage>
7
</startpage>
<endpage>
7
</endpage>
<TOCEntry>
example document, page 7
</TOCEntry>
</inputpdf>
</sourcepdfs>

Including a range to the end of the file

To include from page 7 to the end of the file:

<sourcepdfs>
<inputpdf>
<file>
./samples/example.pdf
</file>
<startpage>
7
</startpage>
<endpage>
-1
</endpage>
<TOCEntry>
example document, page 7 to end
</TOCEntry>
</inputpdf>
</sourcepdfs>

Including the last page only

To specify the last page when you are not sure what number it will be:

<sourcepdfs>
<inputpdf>
<file>
./samples/example.pdf
</file>
<startpage>
-1
</startpage>
<endpage>
-1
</endpage>
<TOCEntry>
example document, last page
</TOCEntry>
</inputpdf>
</sourcepdfs>

Introduction

The element <docinfo> specifies values for fields Acrobat uses in its document information feature. You can specify values for the following information fields:

  • Title
  • Subject
  • Author
  • Keywords
  • Custom

The table below describes the elements of <docinfo>.

Contents of the <docinfo> Element

Element Level Required Content
<appendparam version=”1.0″> Top Green check mark Topmost element, contains entire parameter spec
⇔ <docinfo> 2   Document Information
<infopair> 3 Green check mark Specifies a key-value pair
<key> 4 Green check mark Text: Information field name
<value> 4 Green check mark Text: Information field value

XML Code Sample

<appendparam version="1.0">
<!-- . Indicates skipped sections -->
<!-- . -->
<!-- . -->
<docinfo>
<infopair>
<key>
Title
</key>
<value>
Using AppendPDF Pro
</value>
</infopair>
</docinfo>
<!-- . -->
<!-- . -->
<!-- . -->
</appendparam>

Elements for <docinfo>

infopair

Specifies a key-value pair as described below.

key

Specifies the Document Information field to set:

• Title
• Subject
• Author
• Keywords
• Custom

You can set a single key or any combination of keys.

value

Specifies the value of the Document Information field specified by <key>.

Usage notes for the elements of <docinfo>

Custom fields

  • Custom fields can be either strings or dates. These fields will appear in the document information window within Acrobat, and can be searched using Adobe Catalog, or retrieved using Appligent’s APGetInfo utility.
  • A string can consist of any name and text value that would add meaningful meta data information to the document.
  • A date must be of the format (D:YYYYMMDDHHmmSSOHH’ mm’), where:

YYYY is the year: required
MM is the month (01-12): optional/default = 01
DD is the day (01–X1): optional/default = 01
HH is the hour (00–2X): optional/default = 00
mm is the minute (00–59): optional/default = 00
SS is the second (00–59): optional/default = 00
O is the relationship of local time to Universal Time (UT): optional/default = unknown
+ means local time is later than UT
– means local time is earlier than UT
Z means local time is UT
HH’ is the absolute value of the offset from UT in hours (00–2X)
mm’ is the absolute value of the offset from UT in minutes (00–59)

  • Adobe Catalog can perform boolean searches on dates, for example, finding an invoice after 2006 but before 2008.

Example

   <docinfo>

<infopair>
<key>Author</key>
<value>Appligent, Inc.</value>
</infopair>

<infopair>
<key>Title</key>
<value>AppendPDF Pro Test</value>
</infopair>

<infopair>
<key>Subject</key>
<value>testing AppendPDF Pro with sample files</value>
</infopair>

<infopair>
<key>Keywords</key>
<value>testing AppendPDF Pro sample files</value>
</infopair>

<infopair>
<key>ExtraText</key>
<value>AppendPDF Pro document</value>
</infopair>

<infopair>
<key>DocDate</key>
<value>D:200707142X2059+04’00’</value>
</infopair>

</docinfo>

Introduction

The element <extras> specifies additional attributes you may want to define for the output file. You can specify:

  • Open mode — whether Acrobat will show the navigation pane with bookmarks, thumbnails, or not at all.
  • Bookmark mode — how bookmarks will be displayed in the Bookmark pane.
  • View mode — the zoom level at which Acrobat opens the document.
  • Open to page — the page number to which you want the document to open.
  • Stamp file — a stamp file to stamp any optional text or images onto the body of the document. (AppendPDF Pro only)
  • Display Mode — the display properties of the Acrobat window when a document is opened.
  • Layout mode — The screen layout at which Acrobat will display the document.

The table below describes the elements of <extras>.

Contents of the <extras> Element

Element Level Required Content
<appendparam version=”1.0″> Top Green check mark Topmost element, contains entire parameter spec
⇔ <extras> 2   Specifies how a document should open
<openmode> 3   Specifies navigation mode in which file should open
OR <showbookmarks> 4   Empty: Specifies that bookmarks should show
OR <showthumbnails> 4   Empty: Specifies that thumbnails should show
OR <shownone> 4   Empty: Specifies only the document should show
OR <fullscreen> 4   Empty: File opens in full screen mode
<opentopage> 3   Text: Specifies page at which the file should open
<viewmode> 3   Specifies the view that the file should open in
OR <actualsize> 4   Empty: File opens actual size
OR <fitheight> 4   Empty: File opens so window fits full height
OR <fitpage> 4   Empty: File opens so window fits full page
OR <fitvisible> 4   Empty: File opens so visible area fits the window
OR <fitwidth> 4   Empty: File opens to fit full width of window
<bookmarkmode> 3   Specifies the initial state of bookmarks
OR <openbookmarks> 4   Empty: Show all bookmarks
OR <closebookmarks> 4   Empty: Collapse all bookmarks
OR <openlevel> 4   Specifies number of bookmark levels shown
<layoutmode> 3   Specifies the initial display layout mode
OR <single> 4   Empty: One page at a time
OR <onecolumn> 4   Empty: Pages in a continuous vertical column
OR <twocolleft> 4   Empty: Two pages side by side, first page left
OR <twocolright> 4   Empty: Two pages side by side, first page right
<displaymode> 3   Specifies the initial window display mode
OR <hidetoolbar> 4   Empty: File opens with tool bar hidden
OR <hidemenubar> 4   Empty: File opens with menu bar hidden
OR <hidewinui> 4   Empty: File opens without window controls
OR <fitwin> 4   Empty: Window opens resized to fit the first page
OR <centerwin> 4   Empty: Centers document window on screen
OR <showtitle> 4   Empty: Displays document title on title bar

XML Code Sample

<appendparam version="1.0">
<!-- . Indicates skipped sections -->
<!-- . -->
<!-- . -->
<extras>
<stampfile>
/fullpath/stampfile.txt
</stampfile>
<opentopage>
5
</opentopage>
<openmode>
<!-- Choose only one of the 4 options -->
<showbookmarks/>
<showthumbnails/>
<shownone/>
<fullscreen/>
</openmode>
<bookmarkmode>
<!-- Choose only one of the 3 options -->
<openbookmarks/>
<closebookmarks/>
<openlevel/>
</bookmarkmode>
<viewmode>
<!-- Choose only one of the 5 options -->
<actualsize/>
<fitheight/>
<fitpage/>
<fitvisible/>
<fitwidth/>
</viewmode>
<layoutmode>
<!-- Choose only one of the 4 options -->
<single/>
<onecolumn/>
<twocolleft/>
<twocolright/>
</layoutmode>
<displaymode>
<!-- Choose one or more of the 6 options -->
<hidetoolbar/>
<hidemenubar/>
<hidewinui/>
<fitwin/>
<centerwin/>
<showtitle/>
</displaymode>
</extras>
</appendparam>

Elements of <extras>

opentopage

The page number at which to open the document.

stampfile (AppendPDF Pro only)

Specifies the path and filename of a stamp file for the appended document. These stamps will not be added to the cover page or the Table of Contents.

viewmode

Specifies the zoom level when the document opens.

actualsize

The document opens at actual size.

fitheight

The document opens so the full height of the page fits into the document window.

fitpage

The document opens so the full page fits into the document window.

fitvisible

The document opens so the visible area of the page fits into the document window.

fitwidth

The document opens so the full width of the page fits into the document window.

bookmarkmode

Specifies the initial state of the document’s bookmarks in the navigation pane.

openbookmarks

Expands the bookmark list to show all bookmarks in the navigation pane when the document is opened.

closebookmarks

Collapses the bookmark list to show only the top level bookmarks in the navigation pane when the document is opened.

openlevel

Expands the bookmark list through level n. For example, for n=3, all bookmarks up to and including the third level are shown. The fourth and higher level bookmarks are collapsed.

layoutmode

Specifies the display page layout when the document opens.

single

Displays one page at a time.

onecolumn

Arranges the pages in a continuous vertical column.

twocolleft

Arranges two pages side by side, the first page on the left.

twocolright

Arranges two pages side by side, the first page on the right.

displaymode

Specifies the window display mode when the document opens. You can specify more than one option.

hidetoolbar

Specifies that the Acrobat tool bar will not be displayed when the document opens.

hidemenubar

Specifies that the Acrobat menu bar will not be displayed when the document opens.

hidewinui

Specifies that the Acrobat window controls will not be displayed when the document opens.

fitwin

Resizes the document window to fit the first page when the document opens.

centerwin

Centers the document window on the screen when the document opens.

showtitle

Displays the document title, rather than the file name, on the title bar and the Windows menu.

Usage notes for the elements of <extras>

Cover pages, Table of Contents pages and body pages each use an independent stamp file. Stamps listed in the Extras section are applied only to the body pages, and will not affect the cover or the TOC pages of the output PDF.

Example

The example specifies using extrasstamp.txt as the stampfile; opentopage is page 7; viewmode as fit the full document width to the window; openmode set to show bookmarks and bookmarkmode displaying 3 levels of bookmarks. displaymode will be set to center the window on screen and show the document title in the title bar.

   <extras>
<stampfile>
/fullpath/extrasstamp.txt
</stampfile>
<opentopage>
7
</opentopage>
<viewmode>
<fitwidth/>
</viewmode>
<openmode>
<showbookmarks/>
</openmode>
<bookmarkmode>
<openlevel>
3
</openlevel>
</bookmarkmode>
<displaymode>
<centerwin/>
<showtitle/>
</displaymode>
</extras

Testing your Parameter Files

A parameter file test should be used to make sure all of the documents are being appended in the way that you expect, and the Table of Contents is formatted properly (AppendPDF Pro only). You can use a parameter file with one or two page documents so you can quickly check results and make small adjustments to margins, colors, line spacing, leaders, etc. You can use a source files block that consists of more than one instance of the same one page file for a very simple test. For example:

<appendparam version="1.0">
<!-- Output file -->
<outputpdf>
<file>
/outputfilepath/output.pdf
</file>
</outputpdf>
<!-- Begin source files -->
<sourcepdfs>
<!-- First input file -->
<inputpdf>
<file>
/inputfilepath/Sample1.pdf
</file>
<!-- First TOC entry -->
<TOCEntry>
Sample A
</TOCEntry>
</inputpdf>
<!-- Second input file -->
<inputpdf>
<file>
/inputfilepath/Sample1.pdf
</file>
<!-- Second TOC entry -->
<TOCEntry>
Sample B
</TOCEntry>
</inputpdf>
<!-- End of input files -->
</sourcepdfs>
<!-- End of source files -->
<TOC>
<file>
/tocfilepath/TOC.pdf
</file>
</TOC>
</appendparam>

This will append two /inputfilepath/Sample1.pdf files, each with a different TOC entry, and save the file as /outputfilepath/output.pdf.

Paramsletter Example

The following puts together the examples we’ve been using throughout this section in the file, paramsletter.xml. For clarity, the following example does not use full path names. We recommend that you use full path names for all files.

<appendparam version="1.0">

<!-- Output File -->
<outputpdf>
<!-- Specify output file -->
<file>./samples/paramsletter_xml.pdf</file>
</outputpdf>

<!-- Begin Source PDFs -->
<sourcepdfs>
<inputpdf>
<!-- First input file -->
<file>./samples/pdfs/sample1.pdf</file>
<!-- Start at page 1 to end of the file -->
<startpage>1</startpage>
<endpage>-1</endpage>
<!-- TOC entry for file 1 -->
<TOCEntry>sample document 1</TOCEntry>
</inputpdf>
<inputpdf>
<!-- Second input file -->
<file>./samples/pdfs/sample2.pdf</file>
<!-- Start at page 1 to end of the file -->
<startpage>1</startpage>
<endpage>-1</endpage>
<!-- TOC entry for file 2 -->
<TOCEntry>sample document 2</TOCEntry>
</inputpdf>
<inputpdf>
<!-- Third input file -->
<file>./samples/pdfs/sample3.pdf</file>
<!-- Start at page 1 to end of the file -->
<startpage>1</startpage>
<endpage>-1</endpage>
<!-- TOC entry for file 3 -->
<TOCEntry>sample document 3</TOCEntry>
</inputpdf>
<inputpdf>
<!-- Third input file -->
<file>./samples/pdfs/sample4.pdf</file>
<!-- Start at page 1 to end of the file -->
<startpage>1</startpage>
<endpage>-1</endpage>
<!-- TOC entry for file 4 -->
<TOCEntry>sample document 4</TOCEntry>
</inputpdf>
</sourcepdfs>
<!-- End source PDFs -->

<!-- Begin Cover Page Block -->
<coverpage>
<!-- Coverpage template -->
<file>./samples/pdfs/lettersample.pdf</file>
<!-- Stamp file for cover page -->
<stampfile>./samples/stampfiles/letterstamp.txt</stampfile>
</coverpage>
<!-- End Cover Page Block -->

<!-- Begin TOC Block -->
<TOC>
<!-- TOC template file -->
<file>/samples/pdfs/toc.pdf</file>
<!-- Stampfile for TOC -->
<stampfile>./samples/stampfiles/tocstamp.txt</stampfile>
<!-- Alternate bookmark text for TOC -->
<bookmarktext>TOC Page</bookmarktext>
<!-- 1.4 inches header down to beginning of TOC entries -->
<headerheight>100</headerheight>
<!-- 3 1/3 inches footer up to bottom of TOC entries -->
<footerheight>240</footerheight>
<!-- Left margin 1/4 inch -->
<leftmargin>20</leftmargin>
<!-- Right margin 1/4 inch -->
<rightmargin>20</rightmargin>
<!-- Helvetica font for TOC entries -->
<fontname>Helvetica</fontname>
<!-- Font size for TOC entries is 14 pt -->
<fontsize>14</fontsize>
<colorspace>
<!-- Colorspace RGB -->
<devicergb>
<!-- RGB color is 0, 87, 44 - Dark Green -->
<red>0</red>
<green>87</green>
<blue>44</blue>
</devicergb>
</colorspace>
<!-- Triple spaced text -->
<linespace>3</linespace>
<!-- Add additional 3 lines after TOC entries -->
<appendblanklines />
<!-- Leader looks like this ......... -->
<leader>.</leader>
<!-- Width of column for TOC page numbers: about 1/2 inch -->
<pagecolumnwidth>40</pagecolumnwidth>
</TOC>
<!-- End of the TOC -->

<!-- Begin Info Block -->
<docinfo>
<!-- Specify Author as "Appligent, Inc" -->
<infopair>
<key>Author</key>
<value>Appligent, Inc.</value>
</infopair>
<!-- Specify Title as "AppendPDF Pro Test" -->
<infopair>
<key>Title</key>
<value>AppendPDF Pro Test</value>
</infopair>
<!-- Specify Subject as "testing AppendPDF Pro with sample files" -->
<infopair>
<key>Subject</key>
<value>testing AppendPDF Pro with sample files</value>
</infopair>
<!-- Specify the following Keywords: testing AppendPDF Pro appending assembly -->
<infopair>
<key>Keywords</key>
<value>testing AppendPDF Pro sample files</value>
</infopair>
<!-- Specify a custom info field of ExtraText as "AppendPDF Pro document" -->
<infopair>
<key>ExtraText</key>
<value>AppendPDF Pro document</value>
</infopair>
<!-- Specify custom info field of DocDate -->
<!-- as the date "July 14, 2007,11:20:56 pm" -->
<!-- Local time 4 hours later than Universal time -->
<infopair>
<key>DocDate</key>
<value>D:20000714235659</value>
</infopair>
</docinfo>
<!-- End of Docinfo -->

<!-- Begin Extras Block -->
<extras>
<!-- Zoom to fit the page when document is opened -->
<viewmode>
<fitpage />
</viewmode>
<!-- Show bookmarks in the navigation pane when the document is opened -->
<openmode>
<showbookmarks />
</openmode>
</extras>
<!-- End of Extras information-->

</appendparam>
<!-- End of parameter file-->

Introduction

We will be using the sample parameter file, paramsletter.txt, in the samples directory as an example throughout this chapter. The default location for AppendPDF on Windows is C:\Appligent\AppendPDF\ and AppendPDF Pro is located in C:\Appligent\AppendPro. On other platforms, it will be wherever you installed it. The paramsletter.txt example, (AppendPDF Pro only), contains most of the features described in these chapters for the purpose of explanation and examples.

Note: AppendPDF does not have all the capabilities that are shown in the examples. Parameters that are specific to AppendPDF Pro will be followed by the notation: (AppendPDF Pro only).

What is a Parameter file?

To run AppendPDF Pro or AppendPDF you will need a parameter file. A text parameter file is a simple text file that contains the instructions AppendPDF Pro or AppendPDF uses to build your new document. Sample parameter files are included with the AppendPDF Pro and AppendPDF installation and are located in the samples directory.

A parameter file includes:

  • The name and directory path of the new, appended PDF file
  • Source file information is a list of the documents to be used for appending, including page ranges and Table of Contents (TOC) entries (AppendPDF Pro only)
  • Cover page information includes the cover page file and the stamp file for the cover page (AppendPDF Pro only)
  • Table of Contents information includes the TOC file, style information, and the stamp file for the TOC (AppendPDF Pro only)
  • Document Info is Title, Author, Subject, Keywords which are viewable within Adobe Acrobat and Acrobat Reader
  • Extras specify additional information such as how the document should open and a stamp file for the body of the document (AppendPDF Pro only)

Important! We will continue to support existing text parameter files. However, new features will only be available using XML files.

Building a Text Parameter File

New file name

The first line of the parameter file is the name of the new PDF file — the output file that will be created by AppendPDF or AppendPDF Pro. For example:

paramsletter.pdf

It is likely that you will be appending files that do not reside in the directory that holds AppendPDF or AppendPDF Pro. To avoid losing track of where your files are being written, we recommend that you include the full pathname for each file that you use. For example:

C:\MyDir\WorkFiles\paramsletter.pdf

Parameter file details

The following sub-chapters describe in detail how to build the rest of the parameter file in text format.

Important! We will continue to support existing text parameter files. However, new features will only be available using XML parameter files.

  • The Source Files Block — Text
  • The Document Information Block — Text
  • Putting It All Together — Text

Introduction

The Source Files Block is required. Following the first line of the parameter file is the list of input or source files that AppendPDF Pro or AppendPDF will use to create the new document. Before beginning the list you must enter the keyword begin_source and at the end of the list insert the keyword end_source. Files will be appended in the order that they appear in the source files list. After each filename are commas and page numbers; this is the notation that AppendPDF Pro and AppendPDF uses for specifying pages and page ranges. Specifying pages is discussed in detail below.

This is an example source file block:

begin_source
Sample1.pdf
Sample2.pdf,1,2
Sample3.pdf,1,1
Sample3.pdf,3,3
Sample4.pdf,2,4
end_source

It is important to make sure that none of your source files have names with commas in them. Since AppendPDF Pro and AppendPDF uses commas for describing page ranges, it will try to interpret any comma it sees as being a part of page information. Each parameter file can have only one source files block. Extra source blocks will be ignored.

Specifying page ranges in your source files block

In AppendPDF and AppendPDF Pro page ranges are delimited by commas. In the source files block shown above, each file has a range of pages specified. The different ways for specifying which pages you want to use are described below. When specifying pages do not insert spaces between file names and commas, or commas and numbers.

  • If no pages are specified with a file, all pages from that file will be appended to the new document. For example:
Sample1.pdf
  • To specify a single page to append from a file, after the file name add a comma, the page number to be appended, another comma and the same page number. This indicates that the beginning and ending page are the same, as in Sample3.pdf below:
Sample3.pdf,1,1
  • To specify a range of pages place a comma after the file name, the number of the first page in the range, another comma, and the last page number of the range. The following example of Sample4.pdf specifies the range of pages 2 through 4:
Sample4.pdf,2,4
  • To specify multiple, non-contiguous pages from a single document, multiple entries need to be made in the parameter file. Below, see that Sample3.pdf is listed twice, once to add page 1 and a second time to add page 3:
Sample3.pdf,1,1
Sample3.pdf,3,3

Note: This is the only way to avoid appending page 2 for this file.

  • To specify all pages from a specific page in a document, list the starting page only. Appending will start from this page and go to the end of the document. The sample below will append pages 2 through the end of Sample3.pdf:
Sample3.pdf,2
  • To specify that only the last page of a document be appended, use the special notation -1 as shown with Sample2.pdf below:
Sample2.pdf,-1

Note: The -1 notation for last page can be used with page ranges. As shown in the example below, the second through the last page of sample4.pdf will be appended:

sample4.pdf,2,-1

Introduction

The Document Information Block is optional. Within Adobe Acrobat there is a feature to view information about a file by choosing Document Properties from the File menu. With AppendPDF Pro and AppendPDF it is possible to populate certain fields of the Document Info with the parameter file. A sample of a Document Properties dialog screen from Acrobat is shown below.

Document Info screen

Below is a Document Info screen in Acrobat for a Sample PDF, also called Document Properties.

Document properties dialog

Title, Author, Subject, and Keywords are fields in the Document Info screen as shown in the figure above. These are the fields that can be modified by AppendPDF Pro and AppendPDF. Enter values in the parameter file as you would like to see them appear when you call up the Document Properties in Acrobat. The fields Title, Subject and Author refer to information specific to that document. Keywords (this is Acrobat’s Keywords, not to be confused with the many other references to keywords in this manual) are usually simple words used for sorting and grouping (December, ProjectX, personal, etc.) and are useful for those who will be indexing their documents with Acrobat Catalog and would like to improve searching efficiency. More about indexing can be found in the Acrobat Guide or the Reader Guide if you don’t have the full version of Acrobat. (Either guide can be found under the Help menu of its respective application.)

To specify document information in a parameter file, list the name of the field followed by its value in parentheses. Before beginning this section the keyword begin_info must be added to the parameter file. At the end of the list close the section with the end_infokeyword:

begin_info
Title (AppendPDF Pro Test)
Subject (testing AppendPDF Pro with sample files)
Author (Appligent, Inc.)
Keywords (testing AppendPDF Pro sample files)
end_info

There is no set number of tabs or spaces that need to appear between the field name and the value in parentheses, as long as there is at least one tab or space. Also, if you do not want to include a Document Info field (for example, if you want Title and Subject, but not Author and Keywords) make sure that keyword is not listed in the Document Info block. Items listed with empty parentheses will cause AppendPDF or AppendPDF Pro to fail.

Make sure that all Document Info keywords (Title, Subject, Author, Keywords) are spelled correctly or AppendPDF and AppendPDF Pro will treat them as custom strings. Custom strings are discussed in the next section.

Optional Custom Information to Add within Document Info

AppendPDF and AppendPDF Pro support two custom field types: strings and dates. These can be added within the Document Info block of the AppendPDF or AppendPDF Pro parameter file which saves them in the keywords section of the Document Properties. The keywords can then be indexed with Acrobat Catalog.

The name of a custom string can be anything you want. Give it any name that will have meaning to you and/or be easy for you to remember. For example:

String1 (This file created by AppendPDF Pro)

or

ExtraText (AppendPDF Pro document)

Custom dates need to conform to the format D:YYYYMMDDHHMMSS. Acrobat Catalog allows dates to be searched using boolean operators. You can tell Catalog to find, for example, invoices whose date is greater than 1999 and less than 2000. A custom date in the Document Info block of the parameter file can be entered as:

DocDate (D:20170714235659)

This example indicates a date of 14 July 2017 with a time of 23:56:59.

Adding Comments

Comments in your parameter file are lines of text that you don’t want to be read by AppendPDF Pro or AppendPDF. They can be either notes to yourself or descriptions of what something does or is used for, which can be useful if others will be accessing the file. Additionally, comments can be used for testing or debugging. You may want to prevent a file from being used in the source list, instead of deleting and retyping the name of the file you can simply “comment it out”. Comments start with the hash or number symbol: # and must be placed at the beginning of a line:

#This is a comment in my parameter file.

The following is an incorrect comment:

begin_source #beginning of the file list

Note: AppendPDF Pro or AppendPDF reads the first line of a parameter file as the name to call the new, appended document. Therefore, if a comment is on the first line of a parameter file and is not preceded by a #, AppendPDF Pro or AppendPDF will think it is the name for the output file. There will be no error messages generated during processing and the output file name will be the text of the comment and it will be written to the AppendPDF Pro or AppendPDF directory. The file will not have a .pdf extension. Remember the # before all comments.

Complete Parameter File Example

Now that we have gone through all of the pieces of a parameter file, we show one in its entirety. This example is almost the same as the sample paramscomplete.txt parameter file that comes with your copy of AppendPDF Pro. The example below uses all the parameter options.

Note: AppendPDF does not support all of the options in this example, however there are two example files located in the Samples directory where you installed AppendPDF. They are parameters.txt and tutorial.txt.

#Complete Parameter file for use with AppendPDF Pro with a cover letter

#Name for the new, appended file
./samples/paramsletter.pdf

#List of files and pages for appending with text for Table of Contents
begin_source
./samples/pdfs/sample1.pdf,1,-1,(sample document 1)
./samples/pdfs/sample2.pdf,1,-1,(sample document 2)
./samples/pdfs/sample3.pdf,1,-1,(sample document 3)
./samples/pdfs/sample4.pdf,1,-1,(sample document 4)
end_source

#Cover page block
begin_coverpage
CoverPage (./samples/pdfs/lettersample.pdf)
StampFile (./samples/stampfiles/letterstamp.txt)
end_coverpage

#Table of Contents block
begin_TOC
TOCPage (./samples/pdfs/toc.pdf)
StampFile (./samples/stampfiles/tocstamp.txt)
BookMarkText (TOC Page)
HeaderHeight (100)
FooterHeight (240)
LeftMargin (20)
RightMargin (20)
FontName (Helvetica)
FontSize (14)
ColorSpace (DeviceRGB)
Red (0)
Blue (44)
Green (87)
LineSpace (3)
Leader (.)
PageColumnWidth (40)
end_TOC

#document info block
begin_info
Title (AppendPDF Pro Test)
Subject (testing AppendPDF Pro with sample files)
Author (Appligent, Inc.)
Keywords (testing AppendPDF Pro sample files)
ExtraText (AppendPDF Pro document)
DocDate (D:20170714235659)
end_info

#Extras block for Stamp Files
begin_extras
Open_Mode (ShowBookmarks)
View_Mode (FitPage)
end_extras

#End of parameter file

The parameter file is a text document which requires the new file name and the list of documents to append. The document information is optional. The Cover page, TOC, and Extras blocks are also optional and used only with AppendPDF Pro.

When this example file is run with AppendPDF Pro, the user will get an output file called appendprocomplete.pdf that contains all of the pages listed in the Source files block of the parameter file.

When File > Document Properties or File > Properties is selected in Acrobat, the Title, Subject, Author, and Keywords fields will be populated with the information as shown in the Document Info block of the sample parameter file. A custom string and date have been added for searching with Acrobat Catalog.

The pages of the appended documents (not the cover or the table of contents) will be stamped by the stamp file listed in the Extras block.

In this chapter…

…you will learn about the options available within AppendPDF.

AppendPDF Options

Refer to General Command-Line Options for details on the general options.
Refer to Applying Standard Security for more information about the security options and working with encrypted documents.

The following is an example of command syntax for AppendPDF.

$ appendpdf [options] parameterfile1.txt [parameterfile2.txt...]

The table below shows command-line options for AppendPDF.

Options summary

Option Parameter Description
-cmds filename.txt Process a collection of files to run at one time.
-b   Include bookmarks.
-extra   Include named destination bookmarks, links, and article threads.
-eb   Keep embedded files.

-cmds — Allows you to process a collection of commands at one time  (optional)

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 AppendPDF command line without the executable name. The commands file does not support wildcards in file names. The following is an example of command-line syntax when running with -cmds:

$ ./appendpdf -p -l logfile.txt -cmds CommandFile.txt

CommandFile.txt contains a list of commands for AppendPDF to process. Below is an example of CommandFile.txt:

-p -iso32000 /appligent/appendpdf/samples/parameters.txt
-p -iso32000 /appligent/appendpdf/samples/paramsbasic.xml
-p -optimize /appligent/appendpdf/samples/tutorial.txt
-p -w /appligent/appendpdf/samples/paramscomplete.xml

-b — Include bookmarks (optional)

Specifies to include the bookmarks of the original PDF files in the new, appended document. If a page (or pages) from an input document has a bookmark, that bookmark will appear in the bookmarks list, in the correct order, in the final appended document.

Note: AppendPDF handles bookmarks that have been created using “Named Destinations” in a special way. If a file has bookmarks with Named Destinations and you append it using -b, AppendPDF will convert the Named Destinations to Regular Destinations and then make the bookmark. Other Named Destinations that are not bookmarks will be ignored.

-extra — Copy named destination bookmarks/links and article threads (optional)

This flag will copy any named destination bookmarks/links, and article threads into the appended document. The -extra flag will only include named destination bookmarks/links and article threads when appending complete documents.  If you are specify a page range for your input files and -extra is on the command line,  no extra bookmarks or article threads will be copied over into the appended document.

-eb — Keep embedded files (optional)

AppendPDF will keep any embedded files included in input files as part of the final output file. This option supports any file type that Adobe Acrobat can embed into a PDF document.

In this chapter…

…you will learn how to run AppendPDF on the command line.

  • Running AppendPDF gives examples of running the AppendPDF software with various configurations of command-line options.
  • AppendPDF Examples runs through the sample files included.

Running AppendPDF

This section gives a variety of examples to help guide you through using AppendPDF on the command-line.

  • The basic command
  • Using more than one parameter file
  • Using wild cards
  • Keeping bookmarks and using most options

Note: AppendPDF is not compatible with documents containing form fields or with documents that are write-protected, password-protected, or encrypted. Make sure all form fields are removed or flattened using FDFMerge or FDFMerge Lite. Make sure all files are write-enabled before using AppendPDF.

The basic command

The simplest form of the AppendPDF command, shown on Windows is:

> .\appendpdf .\Samples\parameters.xml

This creates a new output file defined in parameters.xml as parameters_xml.pdf in AppendPDF, appending the pages from the documents listed there.

Note: Make sure that all path names are correct for all files listed on the command line and in the parameter file.

Using more than one parameter file

AppendPDF can process multiple parameter files at one time. Use the -l and -p options to create a log file. Progress and error messages are printed to the specified log file, and to the screen, as shown below on UNIX:

$ ./appendpdf -p -l logfile.txt ./samples/parameters.xml./samples/tutorial.xml
Processing parameter file : ./samples/parameters.xml
Output : ./samples/parameters_xml.pdf
Appending source files...
Appended : ./samples/pdfs/sample1.pdf
Appended : ./samples/pdfs/sample2.pdf
Appended : ./samples/pdfs/sample3.pdf
Appended : ./samples/pdfs/sample4.pdf
Appended : ./samples/pdfs/sample3.pdf
Appended : ./samples/pdfs/sample3.pdf
Appended : ./samples/pdfs/sample4.pdf
Appended : ./samples/pdfs/sample4.pdf
done.
Processing parameter file : ./samples/tutorial.xml
Output : ./samples/tutorial_xml.pdf
Appending source files...
Appended : ./samples/pdfs/sample1.pdf
Appended : ./samples/pdfs/sample2.pdf
Appended : ./samples/pdfs/sample3.pdf
Appended : ./samples/pdfs/sample4.pdf
done.
AppendPDF completed successfully.

Make sure that all path names are correct for all files listed on the command line and in the parameter file.

If the same documents are used in different parameter files, AppendPDF will open and close them separately, each time they are needed. To process three separate parameter files, param1.xml, param2.xml, and param3.xml:

$ ./appendpdf ./path/param1.xml ./path/param2.xml ./path/param3.xml

Using wild cards

Instead of listing all the files on the command line, use ? or * to match one or more characters in a filename:

param?.xml processes any file named “param” and any single character and a .xml extension:

$ ./appendpdf param?.xml

*.xml processes any file in the current working directory with the .xml extension:

$ ./appendpdf *.xml

param* processes any file in the current working directory with “param” in its file name, both xml and txt files:

$ ./appendpdf param*

* processes all files in the current working directory both xml and txt files:

$ ./appendpdf *

Note: AppendPDF will fail if it tries to process a file that is not a valid parameter file. We recommend always using .txt or .xml in file specifications (the first two examples). If you leave out the extension, make sure the working directory contains only valid parameter files.

Keeping bookmarks in appended files

Use the -b option in AppendPDF to keep bookmarks:

$ ./appendpdf -b ./samples/parameters.xml

If a page in a source document is bookmarked, the bookmark for that page will appear in the bookmarks list in the order that the page appears in the new appended document.

Using most options together

You may combine any AppendPDF options together in one command:

$ ./appendpdf -p -l mylog.txt -b ./samples/parameters.xml

The output from this command will be a document as named in parameters.xml, with bookmarks. The screen will show progress information and all progress will be written to the log file, mylog.txt.

AppendPDF Examples

Here we examine some of the samples in the “Samples” subdirectory of AppendPDF.

A basic append

Find the parameter file in the Samples directory.

To append the sample files:

  1. Change your working directory to the AppendPDF directory.The parameter file parameters.xml uses relative paths from here for all files. The example will fail if you do not run from this directory.

    The default location for AppendPDF on Windows is:

    C:\Appligent\AppendPDF

    On other platforms, it will be wherever you installed it.

  2. Enter the following command for UNIX and Mac OS X:
    $./appendpdf ./samples/parameters.xml

    or in Windows:

    > .\appendpdf .\samples\parameters.xml
  3. Open the output file ./samples/parameters_xml.pdf in Acrobat or Acrobat Reader to see the results of the sample files appended together.

Running the other samples

AppendPDF includes another example parameter file named tutorial.xml. Run this one for more examples of what AppendPDF can do.

In this chapter …

… we discuss general command-line options for Appligent server applications.

Common command-line options are used in all Appligent server applications. These options deal with product information, progress messages, and file maintenance. For information on command options that are specific to AppendPDF and AppendPDF Pro see AppendPDF Options or AppendPDF Pro Options.

Note: If you are new to using command-line applications see Getting Started With Command Line Applications.

This chapter provides detail for the common options only. The following table provides a summary of the common command-line options.

General options — summary

OPTION PARAMETER DESCRIPTION
-r RegNum Pass registration number to AppendPDF or AppendPDF Pro.
-l logfile Write progress information or errors to a specified log file.
-p   Display progress messages to the console or screen.
-n   Do not write anything to the console or screen.
-v   Display version information.
-h or -help   Display usage information.
-i   Perform incremental save.
-w   Linearize the file upon 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).

General options — detailed

The following sections provide details on using the general command-line options.

-r <RegNum> — Pass registration number to AppendPDF or AppendPDF Pro

This option can be used to supply your registration number to AppendPDF or AppendPDF Pro from a script or another application:

$ appendpdfapp -r XXXX-XXXX-XXXX-XXXX-XXXX-XXXX [other options]parameterfile1.xml [parameterfile2.xml...]
$ appendproapp -r XXXX-XXXX-XXXX-XXXX-XXXX-XXXX[other options] parameterfile1.xml [parameterfile2.xml...]

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> — Create a log file (optional)

Specify a text file for any errors and progress messages. This option is helpful for debugging. The -l <logfile> option must be followed by a file name. If there are no errors, no file is written. If a log file is not specified, errors are written to the default log file, appendpdf.log. The default log file name is the same for both AppendPDF and AppendPDF Pro. 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, and to the default log file, appendpdf.log. This option is helpful for debugging and for understanding how AppendPDF or AppendPDF Pro works. If the -p option is present on the command line, all errors and progress messages are written to the default log file, appendpdf.log.

A note on using -p and -l <logfile> together

As outlined in the above sections, the -p option gives you progress messages and errors on your screen and the -l <logfile> option writes error messages to a file you specify. The table below provides more detail on using these options alone or together.

Using -p and -l <logfile>

-l -p ERRORS
FOUND
RESULT
Green check mark     Nothing will be written to the screen or to the log file you specify.
  Green check mark   Progress message will be written to the screen and appendpdf.log.
Green check mark Green check mark   Progress messages will be written to the screen and to the log file you specify.
    Green check mark An appendpdf.log file will be created with the errors in your working directory.
Green check mark   Green check mark Errors will be written to the log file you specify.
  Green check mark Green check mark Errors will be written to appendpdf.log and your screen.
Green check mark Green check mark Green check mark 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 AppendPDF or AppendPDF Pro 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 — Display version information (optional)

Display the version of AppendPDF or AppendPDF Pro you are running. This is important when corresponding with support@Appligent.com. In order to better understand your problem, we must know what version of the software you have. AppendPDF or AppendPDF Pro will not do anything else if you use this option.

-h or -help — Show usage (optional)

Display all available command-line options. AppendPDF or AppendPDF Pro will not do anything else if you use either of these options.

-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.

-w — Linearize the file upon save (optional)

Save the output file as a linearized document (also known as optimization). 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.

-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).

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 AppendPDF or AppendPDF Pro command-line without the executable name. The commands file does not support wildcards in filenames. Below are examples of command line syntax when running with -cmds:

$ ./appendpdfapp -p -l logfile.txt -cmds CommandFile.txt
$ ./appendproapp -p -l logfile.txt -cmds CommandFile.txt

CommandFile.txt contains a list of commands for AppendPDF or AppendPDF Pro to process. This is an example of a CommandFile.txt file:

-p -iso32000 /appligent/appendpro/samples/parameters.txt
-p -iso32000 /appligent/appendpro/samples/paramsbasic.xml
-p -optimize /appligent/appendpro/samples/tutorial.txt
-p -w /appligent/appendpro/samples/paramscomplete.xml

In this chapter…

…we discuss the standard Acrobat security options and how to set them.

  • Acrobat Standard Security is an overview of the three levels of Acrobat security and passwords.
  • Security Options lists the options and how to use them to set either low level or high level encryption.
  • Verifying Security Features shows how to verify that the document is encrypted the way you want it.

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:

Document Security properties

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.

Document open password dialog in Acrobat

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.

Document security properties


Examples

Here are some examples of using AppendPDF with encryption options.

Appending documents with 128-bit encryption

The default encryption is 128-bit so you do not need to specify -keylength unless you are using 40-bit encryption as shown in the second example below.

$ ./appendpdf -p -encrypt -ownerpass Pa55w0rd -userpass paSsWoRd-nomodify -noassembly -nonotes -nofill -nohighres -nocopy./Samples/parameters.xml

The output file will be a new PDF document as specified in the parameters.xml file. The output PDF will be encrypted with 128-bit encryption, with owner and user passwords. It will not allow changes, high resolution printing, or copying the document.

Appending documents with 40-bit encryption

$ ./appendpdf -p -encrypt -keylength 40 -ownerpass PaSsWoRd-noprint -nomodify -nocopy ./Samples/parameters.xml

The output file will be a new PDF document as specified in the parameters.xml file. It is secured with 40-bit encryption and an owner password against printing, modifying and copying.

In this chapter…

…we will discuss automating AppendPDF and AppendPDF Pro with scripts. Content that is specific to AppendPDF Pro is followed by the notation: (AppendPDF Pro only).

It is likely that you will wish to incorporate AppendPDF or AppendPDF Pro into scripts that you build to make appending and delivering documents an automatic process.

AppendPDF and AppendPDF Pro, as command-line driven applications, can be run from any programming or scripting language (or other application) that can make a call to a command line.

This is especially true for regular weekly and monthly reports, or web pages that contain variable information, but in a consistent or standardized format. For example: a monthly sales report can be automatically generated by programmatically selecting individual sales reports from a standard set of directories. In addition to appending the periodic reports into a single document, a cover sheet, table of contents, and bookmarks can be generated.

When AppendPDF or AppendPDF Pro is combined with Appligent’s FDFMerge product, an application that merges FDF data files with PDF forms, it becomes practical to generate a complete report from dynamic information that is either entered manually (for example, via web forms) or automatically using database queries. Individual standardized report sections can be automatically filled in and saved into a standard set of directories with standardized file names. These dynamically generated PDF sections can then be appended into a single document.

Be Aware of Your Options

In addition to dynamic control of automatic document generation via parameter files, you can dynamically utilize the AppendPDF or AppendPDF Pro command-line options to produce different output under different conditions. Options to consider when dynamically executing AppendPDF or AppendPDF Pro include:

  • Showing Progress (-p) An if statement can determine whether this is an interactive run or a background run and can then turn progress on or off as appropriate.
  • Writing to a Log File (-l <logfile>) — This is usually a good idea for batch document processing. Either the same log file can be appended, or a new log started with each run. A sophisticated script could check the log for errors and e-mail the administrator with any problems.
  • Adding Bookmarks (-b) — Whether a script is designed to be interactive or run in the background as a batch process, an argument can be set to turn bookmarks on or off according to user preference.
  • Version Information (-v) — Using this option with the log file option will capture the product version information in the log file.

When dynamically generating a parameter file, you should consider such options as:

  • Page ranges — Using page ranges lets you specify partial documents to be included, and the -1 notation can be used in a range to indicate the last page.
  • Document info — Any information you would like to attach to a document can go into the Document Info area of the output file.

Dynamically Generate Parameter Files

One way to automate AppendPDF or AppendPDF Pro would be to avoid having to type in each of your source files in the parameter file by creating a simple shell script to enumerate the contents of a directory directly into the parameter file.

Dynamic parameter files may be generated from Perl, Java, VBScript, Tcl or any shell script. Developing scripts to generate parameter files is a more efficient approach to PDF document generation when the document contents, file paths, and parameters are variable. Such scripts are also easier to maintain than many separate static parameter files.

For larger batch document runs, you can take advantage of the ability of AppendPDF and AppendPDF Pro to process several parameter files at a time.

The dynamic generation of one or more parameter files enables you to utilize the full power of AppendPDF and AppendPDF Pro. Examples of some of these advanced capabilities, include:

Cover page block — AppendPDF Pro only

The user could select from a list of pre-made cover pages, or select from any desired combination of cover sheet and cover sheet stamps. This would permit periodic “standardized” reports to retain a fresh look with each edition.

TOC block — AppendPDF Pro only

In addition to turning Table of Contents (TOC) information on or off, the user could be given the option of determining the appearance of the TOC by selecting from a list of standardized fonts, font sizes and colors. The application of stamp(s) to the TOC (for example, page numbers) could also be optional. The user could even override the default section titles in the generated TOC.

Extras block — AppendPDF Pro only

Since Extras stamps are only applied to the body of the generated document and not to the Cover Page or TOC, the user can be encouraged to provide additional stamped information for the body, for example, in the page header and footer. Stamped information containing text strings can contain variable items. An appropriate stamp could be programmatically generated or selected from a pre-defined or pre-generated collection of stamp files (for example, one for each department, group, or individual for which the document is targeted).

Dynamically generate stamp files — AppendPDF Pro only

The same considerations that have been given to dynamic parameter file generation can be given to the dynamic generation of stamp files. By combining both techniques, an up-to-date or even fully custom document can be generated. Either the user or the program can provide values for such variables and attributes as:

  • Text to be stamped
  • Stamps for the cover page
  • Stamps for the TOC
  • Headers and Footers
  • Watermarks (DRAFT, Confidential, etc.)
  • Font, Font Size and Color of the Stamped Text
  • Text Mode (solid, outline, invisible)
  • Location or Position of the Stamped Text
  • Pages (and pages within Sections) to receive a particular stamp
  • % variables for dates, times, page numbers and section numbers

Since AppendPDF Pro is sensitive to the exact format of stamp files, it is very important to understand the format requirements and that the program or script generates only well-constructed stamp files (for example, balanced parentheses, % signs, etc.).

Develop Large Documents in Stages

Large documents should be developed in stages, rather than in a single AppendPDF or AppendPDF Pro execution, so the results of each processing stage can be checked before proceeding. Customizations can be applied to each individual stage as well as to the final document as a whole. All of this “multi-stage” processing could be accomplished under the control of a single program or script, for example, a period (daily, weekly, monthly) report or web-content generation program.

AppendPDF and AppendPDF Pro can be integrated into a program or script that generates multiple parameter files, then executes AppendPDF or AppendPDF Pro to compile various “Sections” or “Chapters”. Then after error checking, append the resultant PDF documents into a single complete PDF document. A file listing all parameter files can be used as the input to a script for a single execution of AppendPDF or AppendPDF Pro.

The illustration below shows appending multiple sections in stages with AppendPDF Pro. When running AppendPDF, there will be no Table of Contents (TOC) or cover page generated since AppendPDF does not have those features.

Stages of running AppendPDF

Error Checking

When dynamically generating parameter files and executing AppendPDF or AppendPDF Pro with various option settings, it is important to perform checks in your scripts to eliminate or minimize possible errors that may otherwise occur. Common errors to search for:

  • source file path strings for internal spaces—especially true of MS Windows file names
  • source file path strings for internal commas

If errors are found, then the script or program can report them and log them and either halt the AppendPDF or AppendPDF Pro run or skip the appending of the erroneous files such as a section or chapter. A script could also insure that file paths are processed properly by surrounding the paths with double quotes.

A complex script or program could perform an operating system level check for the existence of each file path and check to make sure the read-permission is correct before proceeding.

When generating even moderately large or complex documents into “compound documents” that include separate sections, a cover page and a TOC (AppendPDF Pro only), it is prudent to programmatically check the results (return codes, error log contents, etc.) of each step before proceeding to the next, thus eliminating an attempt to append all of the components into an incorrectly created document.

Introduction

AppendPDF is a command-line application. If you are used to the Microsoft Windows or Apple Mac OS X operating system, you may not be familiar with running command-line tools. This section shows you all you need to get started.

  • Windows tells you how to use AppendPDF on Windows.

Note: You can refer to the Getting Started With Command Line Applications for additional information on using command-line applications.

Windows

To run AppendPDF in Windows, you need to open a Command Prompt window.

In Windows 7:

  • Click Start > Programs > Accessories > Command Prompt

In Windows 10:

  • Click Start > Windows System > 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 AppendPDF is located in, type:

C:\>cd \Appligent\AppendPDF\

The command prompt changes to:

C:\Appligent\AppendPDF>

to show you where you are.

To move back one level, use the shortcut of two periods (..)

C:\Appligent\AppendPDF>cd..

Don’t forget to press the Enter key after every command. You will now be in this directory:

C:\Appligent>

Move back to AppendPDF:

C:\Appligent>cd AppendPDF

Listing the contents of a directory

Use the dir command to list the contents of a directory:

C:\Appligent\AppendPDF>dir

The computer responds with a listing of all the contents of the AppendPDF directory.

If the directory contents fly by too fast to read, do this:

C:\Appligent\AppendPDF>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\AppendPDF>dir /s

This displays the contents of AppendPDF and all the subdirectories under it.

Running AppendPDF

To run AppendPDF, 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. A simple command would be:

> .\appendpdf \path\samples\parameters.xml

The parameters.xml file contains all the parameters to create a complete compiled PDF document.

Now, refer to the rest of this User Guide for details about using AppendPDF.

In this chapter…

… we present a collection of hints and tips for working with AppendPDF and AppendPDF Pro. If you are having trouble with the software, consult this list of issues for a possible solution.

Common error checklist

Before proceeding, if you are having problems with your PDF files, check that they are well-formed and not corrupt. Refer to Cleaning Up PDF Documents.

  • AppendPDF or AppendPDF Pro will not work properly with files that contain active form fields. You must flatten the form fields before running the files through AppendPDF or AppendPDF Pro.
  • AppendPDF or AppendPDF Pro will not work with encrypted or write-protected files. Full permission on all files and paths is required for AppendPDF or AppendPDF Pro to work properly.
  • When using the log file option, -l, there must be a log file name immediately following the -l option. If there is no file name, AppendPDF or AppendPDF Pro will not process and an error message will be appended to the bottom of your parameter file.
  • Make sure all file and path names are correct. If you are working in one directory and AppendPDF or AppendPDF Pro resides in another, you must account for that in your parameter file and command line. We recommend that you always use full paths to all files used in your parameter file.

For parameter files:

  • Be aware that if even one path or file name is wrong in your parameter file the entire append will fail.
  • Recheck the construction of the parameter file. Misspelled keywords (i.e., BeginSource instead of begin_source in the text parameter file) or keywords left out will cause AppendPDF or AppendPDF Pro to fail. For xml parameter file, make sure tags are balanced, each tag has a begin and end tag: <inputpdf>file.pdf</inputpdf>
  • Make sure there are no commas in filenames. AppendPDF or AppendPDF Pro will try to interpret the commas as part of a page range for the document.
  • Make sure there are no spaces in source file entries. All items in the source files block of the parameter file should have no spaces between filename, commas, and page numbers.
  • Make sure there is at least one space between an individual parameter and the parentheses that hold the value for that parameter, like this:
    parameter1 (value)
    parameter2 (value)
  • Comments must be at the beginning of a line and start with the # symbol. If you are using comments in your parameter file, make sure they start at the beginning of a line.
  • A parameter file should contain only one source files block. AppendPDF and AppendPDF Pro will ignore any source files block after the first one. Add all files to be appended together into one block. Use multiple parameter files to generate multiple output PDF files.

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.

E-mail

You can contact support directly by sending an e-mail to support@appligent.com. Support e-mails are answered within one business day during the normal business hours listed below.  

Telephone & Fax

  • Telephone: +1 610 284 4006
  • Fax: +1 610 284 4233
To better serve you, please call us during our normal business hours, Monday - Friday, 8:00 am - 5:00 pm U.S. EST/EDT.
 

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)

New Features

Please see the AppendPDF Options for the full documentation of the new features.

AppendPDF 5.5

Fixed in this release

Options set in Advanced Tab of the first input PDF file are copied over into the output appended document.  In previous versions of AppendPDF, if a Language was set in the first input file, the Language was not copied into the appended document.

Document property information was not getting overwritten in the output file if the first input PDF already contained data in the fields (Title, Author, Subject).  In version 5.5, document property fields are now properly updated with the information set in the parameter file.

AppendPDF 5.1

-cmds <filename>

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 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.

AppendPDF 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).

• -b on command line: All bookmarks from the original files are copied into the appended document. NEW behavior for version 5.0: If an input file does not have ANY bookmarks, a top level bookmark is created. The name of the bookmark will be the “Title” of the PDF. If there is no “Title” set, then the name of the PDF will be the name used for the bookmark.  JavaScript bookmarks are now also supported. Top level bookmarks are always expanded.
• -extra: This flag will copy any named destination bookmarks/links, and article threads into the appended document. If this flag is on the command line AND a page range is specified for an input file, no extra bookmarks or article threads will be copied over into the appended document

AppendPDF 4.3

• New XML Parameters: Additional functionality has been added to the XML which provide more control over the appearance of the output PDF document.

  • <extras>: This new element specifies additional attributes you may want to define for the output file.
  • <opentopage>: The page number at which to open the document.
  • <openmode>: Specifies what is displayed when the document opens in Acrobat. Options for openmode are:
    • <showbookmarks>: The document opens with the bookmarks navigation panel showing
    • <showthumbnails>: The document opens with the thumbnails navigation panel showing.
    • <shownone>: The document opens with no navigation panels showing.
    • <fullscreen>: The document will open in the fullscreen mode.
  • <viewmode>: Specifies the zoom level when the document opens. Options for viewmode are:
    • <bookmarkmode>: Specifies the initial state of the document’s bookmarks in the navigation pane. This does not affect the visibility of the bookmark pane.
    • <openbookmarks>: Expands the bookmark list to show all bookmarks in the navigation pane when the document is opened.
    • <closebookmarks>: Collapses the bookmark list to show only the top level bookmarks in the navigation pane when the document is opened.
    • <openlevel>: Expands the bookmark list through level n. For example, n=3, all bookmarks up to and including the third level are shown. The fourth and higher level bookmarks are collapsed.
  • <layoutmode>: Specifies the display page layout when the document opens.
    • <single>: Displays one page at a time.
    • <onecolumn>: Arranges the pages in a continuous vertical column.
    • <twocolleft>: Arranges two pages side by side, the first page on the left.
    • <twocolright>: Arranges two pages side by side, the first page on the right.
  • <displaymode>: Specifies the window display mode when the document opens. You can specify more than one option.
    • <hidetoolbar>: Specifies that the tool bar will not be displayed when the document opens.
    • <hidemenubar>: Specifies that the menu bar will not be displayed when the document opens.
    • <hidewinui>: Specifies that window controls will not be displayed when the document opens.
    • <fitwin>: Resizes the document window to fit the first page when the document opens.
    • <centerwin>: Centers the document window on the screen when the document opens.
    • <showtitle>: Displays the document title, rather than the filename, on the title bar and the Windows menu.

Fixed Issues

• -n – Do not write anything to screen. The option to not write anything to the screen (or STDOUT) now works.
• Links with named destinations, articles and threads can be copied into the appended document by including the -extra flag on the command line.
• The -eb flag to include embedded files is not working in this version.

Known Issues

Stamping and Setting Doc Info

Occasional problem with setting and stamping doc info (title, author, subject) on document.

Verification of correctly formed XML files

Occasionally, AppendPDF will not verify a correctly formed XML file when the DTD is included in the XML file. AppendPDF returns the error message “Error in parameter file.” To run a file that gives this error with AppendPDF, remove the DTD from the XML file.

Form fields

Form fields are incompatible with AppendPDF. If your document has form fields, AppendPDF will not rebuild the form tree within the PDF document following the append operation. Thus, form fields will not function properly after being appended.

Linking Problems

When portions of documents are appended, links in the appended section will work only if they link to a page within that section. If multiple sections of the same document are appended, links between those sections will not work.

Bookmarks

If your file contains Named Destination bookmarks, you need to include the -extra flag on the command line for the bookmarks to be copied into the appended document. 

Note: If this flag is on the command line AND a page range is specified for an input file, no extra bookmarks or article threads will be copied over into the appended document.

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.