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 – Text and fonts (Part 2)

33 sec read

When substituting fonts, there is one important questions we need to solve…

What happens if we do not recognise the font?

There are 3 alternatives we have for handling fonts we do not have setup for substitution:-

a. Ignore the fact and use the font name. (HTMLFontMapper.IGNORE)

b. Use a default. (HTMLFontMapper.DEFAULT_ON_UNMAPPED)

c. Fail (forcing the user to fix the issue by setting up a mapping (HTMLFontMapper.FAIL_ON_UNMAPPED)

It is set by a single call when we setup HTML extraction

HTMLDisplay.setValue(HTMLDisplay.FontMode,
                 HTMLFontMapper.DEFAULT_ON_UNMAPPED);

If you look at the code you will also see THREE currently unused options (EMBED_UNKNOWN_AS_IMAGE, EMBED_UNKNOWN_WITH_FONT, EMBED_ALL) which might whet your appetite for some possible future enhancements…

Click here to see all the articles in the PDF to HTML5 conversion series.

This post is part of our “Fonts Articles Index” in these articles we explore Fonts.

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.

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 2020. All rights reserved.