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.

Do you need to process or display PDF files?

Find out why you should be using IDRSolutions software

Introductory PDF font tutorial

1 min read

PDF fonts is a tricky subject and one we frequently get asked about. So we have a lot of tutorials on the subject. I hope they prove useful and if you have any specific questions, please send me a question and I will make it into an article.

So let us start at the beginning….

How do fonts work in a PDF file

PDF files can contain images, Vector graphics and text. All the text can be in any font. There are 5 standard font families which all PDF viewers must contain (Times, Helvetica, Courier, Symbol and ZapfDingbats) so these can be used in any document. You can use any other font – my daughter always uses her Malinka font because she loves the letters made from cats. In this case there are three possible approaches. These are set in the PDF creation tool:-

1. Just include the name of the font and hope it is on everyone’s machine. If it is not, it will be replaced with a Standard font.

2. Embed the font. This means include the actual font data inside the PDF. You can then guarantee that it will be on everyone’s machine because it is in the PDF file (but can only be used by the PDF containing it). The problem with this is that some fonts are very large, so it makes the PDF files much bigger.

3.  Embed and subset the font. This means include just the data needed to draw any characters. So if my daughter creates a PDF containing the phrase ‘THE CAT SAT ON THE MAT’, it would embed just the font data for the letters T, H, E, C, A, S, O, N, M. This is a good compromise as it keeps the file small but guarantees the PDF file will appear as you wanted it.

Types of PDF font

What can make things confusing is that PDF files can use several different types of font technology.

Type 3

This is the original and simplest font technology. Fonts generally look quite ‘crude’ and you cannot extract the text values.

Postscript (Type1)

These types of fonts produce much higher quality output and you can extract the text values.

TrueType

This was created as an alternative to Postscript (which Adobe owned the patents on) by Microsoft and Apple. It also produces high quality output and enables text extraction. Because it was the default for Windows, there is a much wider selection of fonts but not all are well-designed.

OpenType

This is a ‘merger’ of the best bits from Postscript and TrueType.

Next steps

You should now have a basic grasp of how PDf fonts works in a PDF file. You might want to read the rest of our tutorials….



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
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.

How to insert an image into a PDF

Recently, we released JPedal 2023.07 which contains the ability to insert images into PDF files. All you need is a copy of JPedal, a...
Jacob Collins
18 sec read

2 Replies to “Introductory PDF font tutorial”

  1. This is a horrible and bland walkthrough with no examples on the inner workings of Fonts. Consider writing in more detail or not writing at all.

Comments are closed.