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 – 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.

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.

Converting your PDF files to HTML5 with PDF2HTML5 

Recently we announced our updated product range for 2018 and are introducing two new products named PDF2HTML5 and PDF2SVG along with rebranding some existing...
Georgia Ingham
3 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

How HTML5 Javadocs in Java 9 will make your…

Here at IDRsolutions we are very excited about Java 9 and have written a series of articles explaining some of the main features. In...
Rob
1 min read

Leave a Reply

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