Section:

Examples of using DocPub

Apryse DocPub is a command-line application designed to convert documents to PDF, XPS, XOD, HTML, or EPUB format files, while presenting several options to control the conversion process. This section covers the basic usage of DocPub explaining all of the available options.

Basic Syntax

The basic command-line syntax is:

DocPub [options] file1 file2 folder1 file3 ...

See more options in Command-Line Summary for DocPub

General Usage Examples

Example 1. The simplest command line: Convert a file to PDF or XOD format.

Notes:

  • Converts 'my.doc' to 'my.pdf' located in the current working folder.

DocPub my.doc

  • Converts 'my.doc' to 'my.xod' located in the current working folder.

DocPub -f xod my.doc

Example 2. Convert XOD file to PDF.

Notes:

  • The '-o' (or --output) parameter is used to specify the output folder. If this option was not specified, all images would be stored in the current working folder.
  • The -f pdf specifies that the output should be an PDF file.
  • The '--verb' option instructs DocPub to output more feedback in the console window.

DocPub -f pdf --verb 2 -o my_output_folder my.xod

Example 3. Batch convert all files to XOD.

Notes:

  • The -f xod option instructs DocPub to convert all files in dir1 folder and its subfolders to XPS format.
  • The '--subfolders' option is used to recursively process all PDF documents stored in subfolders of dir1 and dir2.

DocPub -f xod --subfolders dir1 dir2

Batch Processing and the Use of Wildcards

DocPub supports processing of multiple input documents in the same run. For example, it is possible to specify multiple PDF folders and DocPub will automatically process all documents matching a given file extension. For example, the following command-line will process all PDF documents in folders 'test1' and 'test2'

c:\> DocPub ---extension pdf -o c:/output_folder c:/test1 c:/test2

Wildcard characters can also be used to process multiple input files.

For example, if a directory contains the following PDF documents:

sh

1C:\test1 >dir
2Directory of C:\test1
3 01/04/2007 03:35 PM <DIR> .
4 01/04/2007 03:35 PM <DIR> ..
5 05/21/2004 02:27 PM A1.pdf
6 05/03/2005 09:38 AM A2.pdf
7 05/20/2003 08:46 AM B1.pdf
8 05/15/2003 12:50 PM B2.pdf

To process all PDF documents in this folder and convert them to XOD format, you could specify:

c:\>DocPub -f xod -o c:/output_folder c:/test1/*.pdf

To process all PDF documents starting with 'A', you could specify:

DocPub -f xod -o c:/output_folder c:/test1/A*.pdf

Or to process all PDF documents ending with '1' and convert them to XOD documents, you could specify:

DocPub -f xod -o c:/output_folder c:/test1/*1.pdf

You can use either of the two standard wildcards --- the question mark (?) and the asterisk (*) --- to specify filename and path arguments on the command line.

The wildcards are expanded in the same manner as operating system commands. (Please refer to your operating system user's guide if you are unfamiliar with wildcards.) Enclosing an argument in double quotation marks (" ") suppresses the wildcard expansion. Within quoted arguments, you can represent quotation marks literally by preceding the double-quotation-mark character with a backslash (\). If no matches are found for the wildcard argument, the argument is passed literally.

Exit Codes

To provide additional feedback, DocPub returns exit codes after completing processing. The exit codes can be used to provide user feedback, for logging, etc. This is particularly important for applications running in an unattended environment.

The following table lists possible exit codes and their description:

sh

1Exit Code Description
2--------------- --------------------------------------------------------
30 All files converted successfully
41 Unspecified error
52 Bad license key
63 Failed to create or write the output file or directory
74 Failed to connect to server

All codes other than '0' indicate that there was an error during the conversion process.

To get detailed information on an error, set the --verb parameter to 2.

The following illustrates a sample Windows batch script that processes exit codes:

sh

1@echo off
2rem convert all files in 'data' folder
3
4DocPub ./data
5if errorlevel 1 goto other_error
6if errorlevel 3 goto failed_create_err
7if errorlevel 0 goto exit
8
9:failed_create_err
10echo Failed to create a directory.
11
12:othererror
13echo An error encountered during processing.
14goto exit
15
16:exit

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales