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 – the standard PDF base font families

41 sec read

With a PDF, you can generally assume that 8 font families (Courier, Arial, etc) are all setup for you and you do not need to embed them. This keeps down the size of the PDF file. However, this does not stop you embedding your own version of a font and using that instead.

So how do we handle this when we convert PDF to HTML5?

HTML5 generally has passable versions of all these fonts, but the user may want to use the version in the PDF file, so it probably makes sense to let the person doing the conversion decide. So we have a JVM flag (org.jpedal.pdf2html.fontMode) with possible values which include HTMLFontMapper.EMBED_ALL_EXCEPT_BASE_FAMILIES and HTMLFontMapper.EMBED_ALL so that you can choose. If you use EMBED_ALL, you will see all the fonts appearing in the HTML5

<!-- Any embedded fonts defined here -->
<style type="text/css" >

@font-face {
font-family: KHBMAA-Quorum-Bold;
src: url(“01/fonts/KHBMAA-Quorum-Bold.otf”);
}

@font-face {
font-family: KHBLNK-Helvetica;
src: url(“01/fonts/KHBLNK-Helvetica.otf”);
}

@font-face {
font-family: KHBLON-Helvetica-Bold;
src: url(“01/fonts/KHBLON-Helvetica-Bold.otf”);
}

@font-face {
font-family: KHBLOO-HelveticaNeue-Black;
src: url(“01/fonts/KHBLOO-HelveticaNeue-Black.otf”);
}

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’s Holy Grail – Vertical positioning for…

It’s safe to say that if someone designed fonts from scratch today they’d be very different on the inside. As with many technologies, the...
Sam Howard
1 min read

WOFF 2.0: What is it, why is it coming,…

WOFF 2.0 is working its way towards being a standard recommended by the W3C, so it seems like a good time to look at...
Sam Howard
2 min read

Web fonts: A quick introduction to Wrapper and Glyph…

I was planning to write about WOFF 2.0 this week, and wanted to link to a previous article I’d written which explains the structure...
Sam Howard
1 min read

Leave a Reply

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