Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

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?

 

Did you know...

IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?

It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page

Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Leave a Reply

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

IDRsolutions Ltd 2020. All rights reserved.