Running the PDF to HTML5 Converter from Command Line
You can run JPDF2HTML5 directly from command line which is useful for running the converter from another language or script. This guide is aimed at developers with knowledge of Java. If you do not know Java, we recommend using the online converter.
- You must download jpdf2html.jar
- Please ensure that Java is installed
- Run from the same location as the jar or provide an absolute path
java -Xmx512M -jar jpdf2html.jar /inputDirectory/ /outputDirectory/
You may want provide more memory by increasing the Xmx value.
Some PDF files are encrypted. To convert these files you will need the additional jars. You can download them here.
java -cp jpdf2html.jar:bcprov.jar:bcmail.jar org/jpedal/examples/html/PDFtoHTML5Converter /inputDir/ /outputDir/
java -cp jpdf2html.jar;bcprov.jar;bcmail.jar org/jpedal/examples/html/PDFtoHTML5Converter /inputDir/ /outputDir/
IDRViewer or No Viewer?
The default mode is the IDRViewer. To generate pure page content you must set -Dorg.jpedal.pdf2html.viewMode=content
java -Dorg.jpedal.pdf2html.viewMode=content -jar jpdf2html.jar /inputDirectory/ /outputDirectory/
How are the settings controlled?
When running from command line, settings are controlled by passing in system properties. Available settings and their values can be found in the Javadocs. The key classes are:
java -Dorg.jpedal.pdf2html.compressImages=true -jar jpdf2html.jar /inputDirectory/ /outputDirectory/