Convert PDF to HTML – a question of scale

When we convert a PDF to HTML we take the PDF page size. So for a standard PDF file, this might well be around 840×595 pixels. This is fine for most uses but sometime users want a larger version.

So we also include a scaling option. When we scale it, we preserve aspect ratio (otherwise the page would look odd). So you could alter this document to be 1680x 1190 pixels or any scaling value (we will multiply 840 and 595 or whatever the dimensions are by this number). And it can also be less than 1 (so you could reduce it to 420×298 pixels).

This works well but up until now it has need you to edit and recompile our example Java code. So we have added a flag so that you can set this value without this when you run the code.

So if you convert PDF to HTML with this Java code

java -Xmx512M -Dorg.jpedal.jai=true -Dorg.jpedal.scaling=”1.5″ -jar JPDF2HTML.jar /Users/markee/html/ /Users/markee/abc/

would give you an HTML file one and a half times the size of the PDF file.

What other features would you like to see as command line flags?

This post is part of our “HTML5 Article index” in these articles, we aim to help you understand the world of HTML5.

 

 

Related Posts:

The following two tabs change content below.

Mark Stephens

System Architect and Lead Developer at IDRSolutions
Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.
Markee174

About Mark Stephens

Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX.

He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>