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.

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

    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.