Skip to main content
Skip table of contents

Why can't I embed a font due to licensing restrictions?

Before we answer this specific question, let's take a look at another question that was posted on Stack Overflow: Do I need a license for Windows fonts when using iText?

Just like all software (including iText), fonts are licensed, but there are different types of licenses.

  • You have fonts that have an open font license like SIL (which is the first font license that comes to mind because that was the license for the Cardo fonts we used in chapter 6), but there are many other licenses that allow you to use a font completely for free.

  • You have fonts that are proprietary in the sense that you cannot redistribute them, but they allow you to embed the font in documents. For instance: the fonts that ship with MS Windows are proprietary. You are not allowed to copy them and ship them for free, however, most of those fonts may be embedded within document files. Embedding allows fonts to travel with documents. Embedded fonts can only be used to print, preview and in some cases edit the document in which they are embedded. (See Font redistribution and license issues in Microsoft's FAQ)

  • Some fonts require a full (paid) license if you want to use and/or embed them. If I remember correctly, the fonts you can download as a font pack for Adobe Acrobat/Reader can only be used in the context of Acrobat. You are not allowed to embed them in a document using software that is not sold by Adobe.

  • Some fonts have restrictions in place that don't allow you to embed the font at all.

You should check the font license of each font you use. Let's take a look at two examples.

Example #1: Arial

Arial was created by the Monotype Imaging Corporation. The Monotype Imaging EULA states:

You may embed the Font Software only into an electronic document that (i) is not a Commercial Product, (ii) is distributed in a secure format that does not permit the extraction of the embedded Font Software, and (iii) in the case where a recipient of an electronic document is able to Use the Font Software for editing, only if the recipient of such document is within your Licensed Unit.

If you have arial.ttf in your C:\\Windows\Fonts\ directory, you probably didn't obtain the font from Monotype. It was probably shipped with your legal copy of Microsoft Windows, and Monotype may have licensed its fonts to Windows under a license that is less strict.

Let's right-click the arial.ttf file, and take a closer look at the properties to find out:

Properties of arial.ttf

Properties of arial.ttf

We're in luck: the Font embeddability is set to "Editable". This means that we can embed the font in a document, not only to print and (pre)view the document, but also to edit the document (e.g. edit form fields). The full license of this font program reads like this:

Microsoft supplied font. You may use this font to create, display, and print content as permitted by the license terms or terms of use, of the Microsoft product, service, or content in which this font was included. You may only (i) embed this font in content as permitted by the embedding restrictions included in this font; and (ii) temporarily download this font to a printer or other output device to help print content. Any other use is prohibited.

We can use this font as long as we use arial.ttf in the context of the Windows license that we bought. This implies that we aren't allowed to copy the arial.ttf to another computer, e.g. we are not allowed to copy this font to a Linux machine. If we need a font that can be distributed (e.g. iText distributed 12 fonts that can be embedded into a PDF file with pdfHTML), we should look for alternative fonts that have a more permissive license, such as OpenSans, OpenSerif, and OpenMono.

Example #2: Celtic Garamond the 2nd

One of our iText users wanted to use the font Celtic Garamond the 2nd in a PDF in a non-commercial context, but whenever he tried to embed that font, the following exception was thrown:

BASH
Exception in thread "main" com.itextpdf.kernel.PdfException:
    CelticGaramondthe2ndRegular cannot be embedded due to licensing restrictions.
    at com.itextpdf.kernel.font.PdfType0Font.(PdfType0Font.java:108)
    at com.itextpdf.kernel.font.PdfFontFactory.createFont(PdfFontFactory.java:235)
    at com.itextpdf.layout.font.FontProvider.getPdfFont(FontProvider.java:303)
    at com.itextpdf.layout.font.FontSelectorStrategy.getPdfFont(
        FontSelectorStrategy.java:84)
    at com.itextpdf.layout.font.ComplexFontSelectorStrategy.nextGlyphs(
        ComplexFontSelectorStrategy.java:85)
    at com.itextpdf.layout.renderer.TextRenderer.resolveFonts(TextRenderer.java:1145)
    at com.itextpdf.layout.renderer.LineRenderer.resolveChildrenFonts(
        LineRenderer.java:1099)
    at com.itextpdf.layout.renderer.LineRenderer.layout(LineRenderer.java:128)
    at com.itextpdf.layout.renderer.ParagraphRenderer.layout(ParagraphRenderer.java:188)

The readme.txt file that accompanies the .TTF file sounds quite permissive:

This font is made by Levi and may be used free of charge for non-commercial projects. Please contact me if you plan to use it for other purposes. It also may be distributed free of charge on any websites provided this file is intact.

The font properties unfortunately tell us otherwise:

Properties of Celtic Garamond the 2nd

Properties of Celtic Garamond the 2nd

One would assume that, with the permissive license in place, there wouldn't be any legal problem using this font in a non-commercial context. From a technical point of view however, it's not allowed to embed this font in a document. The font properties clearly state that font embeddability is "Restricted": This explains the exception that is thrown by iText. You aren't allowed to embed the font.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.