In this chapter…

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

Running AppendPDF Pro

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

Note: AppendPDF Pro 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 Pro.

The basic command

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

> .\appendpro .\Samples\paramsbasic.xml

This creates a new output file defined in paramsbasic.xml as paramsbasic_xml.pdf in AppendPDF Pro, appending the pages from the documents listed there. All stamp files, TOC pages, and cover pages are already built into the parameter file, so they are not needed on the command line.

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 Pro 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 Mac OS X / UNIX:

$ ./appendpro -p -l logfile.txt ./samples/paramsbasic.xml ./samples/paramsstd.xml
Processing parameter file : ./samples/paramsbasic.xml
Output : ./samples/paramsbasic_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/paramsstd.xml
Output : ./samples/paramsstd_xml.pdf
Building Table of Contents...
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.
AppendPDF Pro 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 Pro will open and close them separately, each time they are needed. To process three separate parameter files, param1.xml, param2.xml, and param3.xml:

$ ./appendpro ./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:

$ ./appendpro param?.xml

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

$ ./appendpro *.xml

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

$ ./appendpro param*

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

$ ./appendpro *

Note: AppendPDF Pro 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 Pro to keep bookmarks:

$ ./appendpro -b paramsstd.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 Pro options together in one command:

$ ./appendpro -p -l mylog.txt -f -b paramsstd.xml

The output from this command will be a document as named in paramsstd.xml, with bookmarks. The screen will show progress information and all progress will be written to the log file, mylog.txt. By using -f, the page numbering will include the cover and table of contents pages.

AppendPDF Pro Examples

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

A basic append

Find the parameter file in the Samples directory.

To append the sample files:

  1. Change your working directory to the AppendPDF Pro directory.The parameter files paramsstd.xml, paramsletter.xml, paramsbasic.xml and parameters.xml use relative paths from here for all files. The example will fail if you do not run from this directory.

    The default location for AppendPDF Pro on Windows is:

    C:\Appligent\AppendPRO

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

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

    or in Windows:

    > .\appendpro .\samples\paramsstd.xml
  3. Open the output files ./samples/paramsstd_xml.pdf in Acrobat or Acrobat Reader to see the results of the sample files appended together.

Creating a mailing package

Find paramsletter.xml in the Samples directory. This example uses lettersample.pdf as the cover page and uses the stamp file letterstamp.txt to stamp the cover page. A Table of Contents is created for the sample PDF files. The cover and Table of Contents pages are appended with the sample PDF files to create a mailing package.  The stamp file, letterstamp.txt, is setup to apply several stamps to the appended document such as a company logo, letterhead, current date, a signature stamp and a confidential watermark.

Note: In the following example, we use relative path names for clarity. We recommend using full path names at all times.

To run the sample files:

  1. Change your working directory to the AppendPDF Pro directory.The stamp and parameter files use relative paths from here for the sample files. It will fail if you do not run from this directory.
  2. Enter the following command for UNIX and Mac OS X:
    $./appendpro ./samples/paramsletter.xml

    or in Windows:

    > .\appendpro .\samples\paramsletter.xml
  3. Open ./samples/paramsletter_xml.pdf in Acrobat or Acrobat Reader to view the stamped, appended file.

Running the other samples

AppendPDF Pro includes the following other samples. Run them for more examples of what AppendPDF Pro can do.

  • paramsbasic.xml — includes basic parameters
  • paramscomplete.xml — includes all parameters
  • paramsbarcode.xml — stamps barcodes on the sample PDF files