Some test text!

menu
search
Free Trial Support

Contents

Basic Syntax
General Usage Examples
Example 1. The simplest command line: Convert PDF to HTML.
Example 2. Convert PDF to HTML with password.
Example 3. Convert PDF to HTML with exported annotation file.
Batch Processing and the Use of Wildcards
Exit Codes

Usage

PDFTron PDFGenie is a command-line application designed to convert PDF documents to HTML or XML files while presenting tables or text depending on the document structure. This section covers the basic usage of PDFGenie explaining all of the available options.

linkBasic Syntax

The basic command-line syntax is:

pdfgenie [options] file1 file2 folder1 file3 ...

See more options in Command-Line Summary for PDFGenie

linkGeneral Usage Examples

linkExample 1. The simplest command line: Convert PDF to HTML.

Notes:

  • The default output format is HTML.

  • The '-o' (or --output) parameter is used to specify the output folder. If this option was not specified, all output would be stored in the current working folder.

pdfgenie -o test_out/ex1 test/in.pdf

linkExample 2. Convert PDF to HTML with password.

Notes:

  • The '--pass' parameter takes PDF files with the password to process the input file. The password is required only when the input document is encrypted.

pdfgenie -o test_out/ex2 --pass secret in.pdf

linkExample 3. Convert PDF to HTML with exported annotation file.

Notes:

  • The '-x' (or --xfdf) exports an xfdf file with annotations representing document segments.

pdfgenie -o test_out/ex2 -x in.pdf

linkBatch Processing and the Use of Wildcards

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

c:\>pdfgenie -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:

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

To process all PDF documents in this folder, you could specify:

pdfgenie -o c:/output_folder c:/test1/*.pdf

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

pdfgenie -o c:/output_folder c:/test1/A*.pdf

Or to process all PDF documents ending with '1', you could specify:

pdfgenie -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. (See 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.

linkExit Codes

To provide additional feedback, PDF2SVG 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:

Exit Code   Description
----------- ------------------------------------
0           All files converted successfully.
1           Unspecified error.
2           Bad license key.
3           Failed to create output directory.
4           Failed to read the input document.
5           The PDF password is incorrect.
6           Conversion error.
7           Failed to connect to server.

All codes other then '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:

@echo off rem convert all PDF files in 'data' folder
pdfgenie data
if errorlevel 1 goto inputerr
if errorlevel 2 goto passwd
if errorlevel 3 goto converr
if errorlevel 4 goto othererror
if errorlevel 0 goto exit

:passwd
echo Document is protected. Need a valid password to open the document.
goto exit

:inputerr
echo No input files specified.
goto exit

:converr
echo A file conversion error was encountered.
goto exit

:othererror
echo An error encountered during processing.
goto exit

:exit

Get the answers you need: Support

Free Trial Support

Contents

Basic Syntax
General Usage Examples
Example 1. The simplest command line: Convert PDF to HTML.
Example 2. Convert PDF to HTML with password.
Example 3. Convert PDF to HTML with exported annotation file.
Batch Processing and the Use of Wildcards
Exit Codes
close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.