Running the PDF to SVG Converter

[Click to edit the title]

Help & Code Samples

Keep updated on changes with our RSS feed

[Click to edit the title]

Related Blog Posts

Series of articles on SVG related topics

The PDF to SVG converter is built into our PDF to HTML5 converter as a free option to give you maximum flexibility. It makes use of our proven Java PDF library and conversion technologies developed for PDF to HTML5 conversion but produces SVG output.

 

How do I run the software 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.

 

Quickstart (if your PDF files do not contain JPEG2000 or Tif images)

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, and $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 org/jpedal/examples/svg/ExtractPagesAsSVG $path_to_jar/JPDF2HTML.jar:$path_to_jai/jai_codec.jar:$path_to_jai/jai_core.jar.jar:$path_to_jai/imageio.jar $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 -Dorg.jpedal.pdf2html.allTextModes="svg" -Dorg.jpedal.jai=true -jar JPDF2HTML.jar /Users/markee/pdfs/ /Users/markee/svg/

You may also want to increase the memory used.

 

What sort of output will I get? 

The code can generate several types of output including:-

  • a total conversion of the PDF to SVG (with text using embedded fonts) default option
  • All content rendered as shapes (TEXT_AS_SHAPE).

You can set them in the ExtractPagesAsHTML example or see them all by setting the JVM flag -Dorg.jpedal.pdf2html.allTextModes="true"

You can set them in the ExtractPagesAsSVG example or see them all by setting the JVM flag to
  • -Dorg.jpedal.pdf2html.allTextModes="svg_true" (all modes)
  • -Dorg.jpedal.pdf2html.allTextModes="svg_shape"
  • -Dorg.jpedal.pdf2html.allTextModes="svg_visible" (not currently available)
  • -Dorg.jpedal.pdf2html.allTextModes="svg_invisible" (not currently available)

 

How do I include the SVG conversion software in my Java code?

It is available as an option in the main HTML5 conversion example. Click here to view the key code for the HTML5 example.

There is also a separate, documented Java PDF to SVG example written which is included in the jar. Click to view the source code. 

 

How do I get assistance?

Our developers are on the forums to answer your questions

 

Will you do the coding for us?

We are happy to provide coding on a commercial basis only. 

 

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 ExtractPagesAsHTML with no parameters or you can access it directly from the static string variableHTMLDisplay.HTMLversion