Mark Stephens I have been working with Java and PDF since 1999 and am a big NetBeans fan. I enjoy speaking at conferences. I have an MA in Medieval History and a passion for reading.

PDF to HTML5 conversion – duplicate font names

43 sec read

When you convert PDF to HTML5, you can have a potential problem of duplicate font names. In a PDF file, you can embed lots of fonts and subset them to ignore just the glyfs you are using (keeping the font size down). So a page could contain several fonts, all called Arial. This is not an issue in a PDF file because the font name is a piece of information not the key used to identify the font.

In a PDF file, it is the unique key which identifies the fonts used in the CSS tag (FONT-FAMILY) and the @font-face tag to embed the font. So we need to ensure that the font name is unique in the HTML5. How will you handle this?

This is how we deal with this. The first time you use Arial, we will call it Arial. If a different version of Arial appears we will append the FontID  (which is how the PDF identifies it) and the size of the font data to give a unique version (Arial_C2_0_5400). Luckily, because the PDF does not use it, we can easily alter it for our own use without breaking anything else and handle all these fonts. Does this seem sensible?

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Mark Stephens I have been working with Java and PDF since 1999 and am a big NetBeans fan. I enjoy speaking at conferences. I have an MA in Medieval History and a passion for reading.

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
2 min read

Favourite resources from our HTML development team

As the web progresses and grows, so do the technologies that come along with it. Trying to keep on top of everything you need...
Ovidijus Okinskas
1 min read

Leave a Reply

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

IDRsolutions Ltd 2019. All rights reserved.