Running the PDF to HTML5 Converter from Command Line

This is aimed at developers with a good knowledge of Java. If you do not know Java, we recommend using the Online converter.

How do I download the Jar File?

This tutorial needs you to download a single jar. It will work with either the 30 day trial or the full commercial version you can download here.

How do I run the service directly from the jar?

You can run the PDF to HTML5 conversion program directly from the jar – for example if you wanted to use it from some other language or script. Please ensure that Java is installed.


To run it, use:

java -jar $path_to_jar/JPDF2HTML.jar $dir_with_pdf_files $output

$path_to_jar is the location of the jar
$dir_with_pdf_files is the location of the PDF files to convert
$output is where to place the converted files. If a directory does not exist it will be created.

If PDF file is Encrypted

You will need the additional  jars – you can download them from here.

java  -cp $path_to_jar/JPDF2HTML.jar:$path_to_bouncycastle/bcprov.jar:$path_to_bouncycastle/bcmail.jar org/jpedal/examples/html/PDFtoHTML5Converter $dir_with_pdf_files $output

Important note for Windows developers: separate the jars with a semi-colon ; rather than a colon :

My Example

Here is my test example:

java -Xmx512M -jar JPDF2HTML.jar /Users/markee/pdfs/ /Users/markee/output/

You may also want to increase the memory used.

How are the output settings controlled?

There are a huge number of configuration options that can be used. When running from command line they can be controlled using JVM flags. A list of all JVM flags and their values can be found on the Javadoc for the HTMLConversionOptions class.

An example conversion setting the Text Mode to svg_realtext is as follows:

java -Dorg.jpedal.pdf2html.textMode=svg_realtext -jar jpdf2html.jar /PDFDir/ /OutputDir/


Do I need any additional jars?

Possibly. If the PDF is encrypted. Full details are here.


The documentation for the examples and key java classes is available Javadocs for HTML,SVG converter or for download in standard Javadoc format.

How do I find the version number of the software?

You can see the version number of the PDF to HTML5 library by running the PDFtoHTML5Converter with no parameters or you can access it directly from the static string variable HTMLDisplay.HTMLversion