This is aimed at developers with a good knowledge of Java who want to convert PDF to SVG in their Java Applications. If you do not know Java, we recommend using the Online converter.
How do I download the Jar File?
How do I convert PDF to SVG directly from the jar?
You can run the PDF to SVG 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.
Quickstart (if your PDF files do not contain JPEG2000 or Tif images)
To run it, use:
java -Dorg.jpedal.pdf2html.svgMode=true -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.
All PDF files
You will need the additional JAI jars – you can download them from here.
java -Dorg.jpedal.jai=true -cp $path_to_jar/JPDF2HTML.jar:$path_to_jai/jai_codec.jar:$path_to_jai/jai_core.jar.jar:$path_to_jai/imageio.jar org/jpedal/examples/svg/PDFtoSVGConverter $dir_with_pdf_files $output
Important note for Windows developers: separate the jars with a semi-colon ; rather than a colon :
Here is my test example:
java -Xmx512M -Dorg.jpedal.pdf2html.svgMode=true -Dorg.jpedal.jai=true -jar JPDF2HTML.jar /Users/markee/pdfs/ /Users/markee/svg/
You may also want to increase the memory used.
How are the output settings controlled in SVG conversion?
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 SVGConversionOptions class.
An example conversion setting the Text Mode to svg_realtext is as follows:
java -Dorg.jpedal.pdf2html.svgMode=true -Dorg.jpedal.pdf2html.textMode=svg_realtext -jar jpdf2html.jar /PDFDir/ /OutputDir/
Javadocs for SVG
How do I find the version number of the software?
You can see the version number of the PDF to SVG library by running the PDFtoSVGConverter with no parameters or you can access it directly from the static string variable HTMLDisplay.HTMLversion