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.

PDF to HTML5 conversion – position accuracy

40 sec read

One of the most complex issues with PDF to HTML conversion is the question of accuracy. In PDF files you can position the contents with almost limitless accuracy.  This is not the case in HTML5.

First of all you can only render the text to the nearest pixel – I often see fonts in PDF at 8.5 pixels in size. Should we use 8 or 9 for the pixel size in HTML5. Neither is a perfect value…

We can show shapes to several decimal places, but this makes the HTML5 files much larger because it is a text file. If I use 4.456 rather than 4, I will add 3 characters everytime (which can make the filesize much larger). Also, is it really worth working at this level of detail when we cannot match it with the text? So pragmatically it makes sense to do some rounding and keep the values as ints.

In conclusion, you can produce some excellent versions of PDF files in HTML5, especially when you use the fonts, but it will not always be an exact match. Why not try the conversion and let us know what you think?

 

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.

Pros and Cons of Bitbucket Pipelines

Recently I have been looking at our current test suite looking for ways to improve our own tests. As we use Bitbucket we have...
Kieran France
3 min read

Converting your PDF files to HTML5 with BuildVu 

Recently we announced our updated product range for 2018 and are rebranding some existing products, like JPDF2HTML5 which has been renamed to BuildVu. It...
Georgia Ingham
3 min read

Leave a Reply

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