Integrate via shell client (CLI)
The command line application client (pdfclient
) lets you automate conversion tasks in a shell script or as a scheduled task.
The shell client application interacts with the Conversion Service via the REST API.
The application creates jobs based on its input parameters.
The jobs are then uploaded in parallel to the Conversion Service and the shell client monitors the completion before the output files are downloaded.
In verbose mode (option -v
), a detailed report including all performed actions on the documents is written to the console.
If warnings or errors occur during processing, they are reported.
Using the CLI
The pdfclient is added to the PATH
environment setting during installation. When called without any arguments, it prints a usage message to standard output.
pdfclient [options] <input> [...] <output>
Option | Description |
---|---|
Generic options | |
-url url | Service endpoint URL (default: http://localhost:13033/conversion/v1.0/rest) |
-v | Verbose mode |
Job options | |
-w wf | Workflow to use for processing; otherwise the default workflow is used |
-p prof | Profile to use for processing; otherwise the default profile is used |
-s | Process all input files as separate jobs, output must be an existing directory |
Input options | |
-pw pwd | Password, applies to subsequent input |
-r | Recursive, include files in subdirectories |
Output options | |
-i | Prompt before overwriting files |
-u | Create unique file name instead of overwriting files |
**Input ** | |
file | Single file, e.g. input.pdf |
wildcard | All matching files, e.g. C:\path\to\files*.pdf |
directory | All files in a directory, e.g. C:\path |
Output | |
file | Single output file. If no extension is specified, it is added automatically. |
directory | Existing output directory, required with option -s |
Return codes | |
0 | Success |
1 | Warnings occurred |
2 | Error |
Basic example
In this example, the CLI sends the file.pdf
and encrypted.pdf
to the Conversion Service through the REST API endpoint URL http://<hostname>:<port>/conversion/v1.0/rest
and saves the result as output.pdf
.
The option -v
turns on verbose mode, option -url
sets the service base URL, and option -pw
supplies the password for encrypted.pdf
.
If the service base URL (-url
) is not set, localhost
and the default port are used.
pdfclient -v -url http://<hostname>:<port>/conversion/v1.0/rest file.pdf ^
-pw <password> encrypted.pdf output.pdf
Unless you have extended the PATH environment setting to include the installation directory of the Conversion Service, you have to specify the full file path to call the pdfclient.exe
program.
Workflow and profile
Use the -w
and -p
options to select a specific workflow and profile for the job.
In this example, the workflow is set to Archive PDF/A-2 and the profile is set to "myCustomProfile".
If the options are not specified, the service’s configured default workflow and profile are used.
pdfclient -w "Archive PDF/A-2" -p "myCustomProfile" input.pdf output.pdf
Wildcards
Sends all files with extension .ext
from the current working directory and all subdirectories to the Conversion Service, and saves the result as a single output document C:\path\to\output.pdf. pdfclient -s *.ext C:\path\to\output
Process the files with extension .ext
as separate jobs and save the results in C:\path\to\output
.
The output directory must already exist. Existing output files are overwritten by default.
Output options such as creating unique filenames instead of overwriting existing files are explained in the usage of the tool.
pdfclient -r *.ext C:\path\to\output.pdf
Batch processing
Sends the files inside C:\path\to\input
, including all subdirectories, to the Conversion Service.
It saves the results in C:\path\to\output
with the same file structure as in the input directory.
Existing output files are overwritten.
Output options such as creating unique filenames instead of overwriting existing files are explained in the usage of the tool.
pdfclient -r -s C:\path\to\input C:\path\to\output