Skip to content

TSTool / Command / PDF


Overview

This command is under development. Functionality may be limited.

The PDF command manipulates PDF files using one of the following sub-commands (additional functionality will be added in the future):

  • Merge - merge multiple PDF input files into one PDF output file

The Apache PDFBox version 3.0.6 software is used to implement the functionality. Additional PDF manipulation features may be added in the future.

Merge Files

The list of input files to merge can be specified using a single pattern or a comma-separated list of patterns, each of which can be specified as:

  • path:
    • absolute path
    • a path relative to the command file folder
  • wildcards:
    • literal path (no wildcards) that exactly matches a file
    • wildcards to match one or more files (see Java PathMatcher):
      • * - match one or more characters at a folder level
      • *.pdf - matches file names with extension pdf
      • **/*.pdf - matches file names with extension pdf in any folder
      • the returned list is sorted alphabetically before being added to the full list of files

Any file that does not end in pdf (any case) is ignored.

In the future, the option to use a table to specify file names may be added, for example using the output from the ListFiles command.

Command Editor

The command is available in the following TSTool menu:

  • Commands / General - File Handling

The following dialog is used to edit the command and illustrates the command syntax.

PDF command editor

PDF Merge Command Editor (see full-size image)

Command Syntax

The command syntax is as follows:

PDF(Parameter="Value",...)

Command Parameters

Tab Parameter                           Description Default          
All PDFCommand A PDF command to execute:
  • Merge - merge multiple PDF files into one output PDF file
None - must be specified.
IfNotFound Indicate action if an input file is not found, one of:
  • Ignore – ignore the missing file (do not warn).
  • Warn – generate a warning (use this if the file truly is expected and a missing file is a cause for concern).
  • Fail – generate a failure (use this if the file truly is expected and a missing file is a cause for concern).
Warn
Merge MergeInputFiles The name of one or more files to append, specified as file patterns separated by commas:
  • No * in filename – match one file
  • *– match all files in input directory (working directory by default).
  • *.pdf – match all files with extension

Can specify using processor ${Property}.
Specify file pattern(s) or text to append.
MergeOutputFile
required
The output file that will be created. The file is created if it does not exist. Use the RemoveFile command to remove the old file. Can specify using processor ${Property}. None – must be specified.

Examples

See the automated tests.

Troubleshooting

See the main TSTool Troubleshooting documentation.

See Also