How to Manage Fonts in PDFs with C#
IronPDF enables comprehensive font management in C# including finding, adding, embedding, unembedding, and replacing fonts in PDF documents to ensure consistent text display across all platforms.
A font is a set of characters, symbols, and glyphs with a consistent style and design. It represents a specific typeface, size, weight, and style (such as regular, bold, italic, etc.) of text. Fonts are used in typography to display text in a visually appealing and coherent manner.
IronPDF provides a convenient way to manage fonts, offering functionalities such as finding fonts, getting fonts, embedding fonts, unembedding fonts, and replacing fonts. Whether you're creating new PDFs or editing existing documents, proper font management ensures your PDFs display correctly across all platforms and devices.
Quickstart: Manage and Embed Fonts in Your PDFGet started with IronPDF to simplify font management in your PDF documents. This guide shows how to embed fonts in PDFs for visual consistency across platforms. With just a few lines of code, you can enhance document appearance and maintain compatibility.
-
1Install IronPDF with NuGet Package Manager
-
2Copy and run this code snippet.
ChromePdfRenderer renderer = new ChromePdfRenderer(); PdfDocument pdf = renderer.RenderHtmlAsPdf("<p style='font-family:MyCustomFont;'>Hello world!</p>"); pdf.Fonts.Add(File.ReadAllBytes("MyCustomFont.ttf")).Embed(); pdf.SaveAs("withCustomFont.pdf");C# -
3Deploy to test on your live environment
Start using IronPDF in your project today with a free trial
Minimal Workflow (5 steps)
- Download the IronPDF C# Library
- Use the
Addmethod to add fonts to the collection - Use the
Embedmethod to embed fonts for persistent visuals - Reduce file size using the
Unembedmethod - Replace fonts easily with the
Replacemethod
How Do I Find and Retrieve Fonts in a PDF?
How do I retrieve all fonts from a PDF?
Accessing the Fonts property returns the PdfFontCollection object containing all document fonts. The Fonts property can be accessed directly by iterating over the PdfFontCollection object. This is particularly useful when working with PDF forms or analyzing document structure.
using IronPdf;
using IronPdf.Fonts;
using System.Collections.Generic;
// Import PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Retreive font
PdfFontCollection fonts = pdf.Fonts;Imports IronPdf
Imports IronPdf.Fonts
Imports System.Collections.Generic
' Import PDF
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Retreive font
Private fonts As PdfFontCollection = pdf.FontsHow do I find a specific font by name?
Finding specific fonts is straightforward with IronPDF. Using the PdfFontCollection object, specify the font name to access font objects and inspect properties. This functionality is essential when you need to replace text in PDF documents while maintaining font consistency.
using IronPdf;
using IronPdf.Fonts;
using System.Collections.Generic;
using System.Linq;
// Import PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Find font
PdfFont font = pdf.Fonts["SpecialFontName"];Imports IronPdf
Imports IronPdf.Fonts
Imports System.Collections.Generic
Imports System.Linq
' Import PDF
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Find font
Private font As PdfFont = pdf.Fonts("SpecialFontName")How Do I Add Fonts to a PDF?
Use the Add method to add standard fonts or font files as byte data. The method accepting font names only accepts one of the 14 standard fonts. Adding standard fonts doesn't embed them since they're guaranteed to be available on operating systems. When converting HTML to PDF, IronPDF automatically handles web fonts from your HTML.
using IronPdf;
using IronPdf.Fonts;
// Import PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Add font
pdf.Fonts.Add("Helvetica");Imports IronPdf
Imports IronPdf.Fonts
' Import PDF
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Add font
pdf.Fonts.Add("Helvetica")For advanced font management including web fonts and icon fonts, IronPDF provides comprehensive support for modern typography needs.
The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.
Why Should I Embed Fonts in PDFs?
Embedding fonts includes the font's byte stream data in the PDF document. This ensures proper display without requiring font installation on viewing systems. While this increases file size, it guarantees visual consistency. This is crucial when creating PDF/A compliant documents or ensuring document portability.
using IronPdf;
using System.Linq;
// Import PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Add the font
byte[] fontData = System.IO.File.ReadAllBytes("dir/to/font.ttf");
// Embed the font
pdf.Fonts.Last().Embed(fontData);Imports IronPdf
Imports System.Linq
' Import PDF
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Add the font
Private fontData() As Byte = System.IO.File.ReadAllBytes("dir/to/font.ttf")
' Embed the font
pdf.Fonts.Last().Embed(fontData)Font embedding is particularly important for international languages and UTF-8 support to ensure characters display correctly across all systems.
When Should I Unembed Fonts from PDFs?
Unembedding removes embedded font byte stream data from PDFs to reduce file size. Use the Unembed method to achieve this. This technique works well with PDF compression strategies to minimize file sizes.
using IronPdf;
using IronPdf.Fonts;
// Import PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
// Get fonts
PdfFontCollection fonts = pdf.Fonts;
// Unembed a font
pdf.Fonts[0].Unembed();Imports IronPdf
Imports IronPdf.Fonts
' Import PDF
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
' Get fonts
Private fonts As PdfFontCollection = pdf.Fonts
' Unembed a font
pdf.Fonts(0).Unembed()If uncommon fonts lack fallbacks after unembedding, they may appear corrupted in the output PDF. Check if Adobe shows the same issue - if so, this is expected behavior. If not, contact support for investigation. Corrupted fonts appear as follows:

How Do I Replace Fonts in PDF Documents?
Font replacement preserves original font data structure, including styling and character encoding, while substituting the specified font. Ensure new fonts align well with originals. This feature is useful when editing PDFs or standardizing fonts across documents.
In rare cases, visual results may not perfectly match. This is a current limitation of the font replacement method.
using IronPdf;
using IronPdf.Fonts;
using System.Linq;
// Import PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
byte[] fontData = System.IO.File.ReadAllBytes("dir/to/font.ttf");
// Get and replace Font
pdf.Fonts["Courier"].ReplaceWith(fontData);Imports IronPdf
Imports IronPdf.Fonts
Imports System.Linq
' Import PDF
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")
Private fontData() As Byte = System.IO.File.ReadAllBytes("dir/to/font.ttf")
' Get and replace Font
pdf.Fonts("Courier").ReplaceWith(fontData)What Are the 14 Standard PDF Fonts?
The 14 standard fonts (Base 14 Fonts or Standard Type 1 Fonts) are widely supported in PDF viewers and don't require embedding. The PDF standard guarantees these fonts are available when working with PDF documents. These fonts are essential for maintaining compatibility when creating PDFs from various sources.
- Courier
- Courier-Bold
- Courier-Oblique
- Courier-BoldOblique
- Helvetica
- Helvetica-Bold
- Helvetica-Oblique
- Helvetica-BoldOblique
- Times-Roman
- Times-Bold
- Times-Italic
- Times-BoldItalic
- Symbol
- ZapfDingbats
Which font names map to standard fonts?
Multiple string names point to the same standard font for convenience. This mapping system ensures compatibility when working with different PDF tools and when merging or splitting PDFs.
Map to Courier
StandardFont.Courier- Courier
- CourierNew
- CourierNewPSMT
- CourierStd
Map to Courier-Bold
StandardFont.CourierBold- Courier,Bold
- Courier-Bold
- CourierBold
- CourierNew,Bold
- CourierNew-Bold
- CourierNewBold
- CourierNewPS-BoldMT
- CourierStd-Bold
Map to Courier-Oblique
StandardFont.CourierOblique- Courier,Italic
- Courier-Oblique
- CourierItalic
- CourierNew,Italic
- CourierNew-Italic
- CourierNewItalic
- CourierNewPS-ItalicMT
- CourierStd-Oblique
Map to Courier-BoldOblique
StandardFont.CourierBoldOblique- Courier,BoldItalic
- Courier-BoldOblique
- CourierBoldItalic
- CourierNew,BoldItalic
- CourierNew-BoldItalic
- CourierNewBoldItalic
- CourierNewPS-BoldItalicMT
- CourierStd-BoldOblique
Map to Helvetica
StandardFont.Helvetica- Arial
- ArialMT
- Helvetica
Map to Helvetica-Bold
StandardFont.HelveticaBold- Arial,Bold
- Arial-Bold
- Arial-BoldMT
- ArialBold
- ArialMT,Bold
- ArialRoundedMTBold
- Helvetica,Bold
- Helvetica-Bold
- HelveticaBold
Map to Helvetica-Oblique
StandardFont.HelveticaOblique- Arial,Italic
- Arial-Italic
- Arial-ItalicMT
- ArialItalic
- ArialMT,Italic
- Helvetica,Italic
- Helvetica-Italic
- Helvetica-Oblique
- HelveticaItalic
Map to Helvetica-BoldOblique
StandardFont.HelveticaBoldOblique- Arial,BoldItalic
- Arial-BoldItalic
- Arial-BoldItalicMT
- ArialBoldItalic
- ArialMT,BoldItalic
- Helvetica,BoldItalic
- Helvetica-BoldItalic
- Helvetica-BoldOblique
- HelveticaBoldItalic
Map to Times-Roman
StandardFont.Times- Times-Roman
- TimesNewRoman
- TimesNewRomanPS
- TimesNewRomanPSMT
Map to Times-Bold
StandardFont.TimesBold- Times-Bold
- TimesBold
- TimesNewRoman,Bold
- TimesNewRoman-Bold
- TimesNewRomanBold
- TimesNewRomanPS-Bold
- TimesNewRomanPS-BoldMT
- TimesNewRomanPSMT,Bold
Map to Times-Italic
StandardFont.TimesOblique- Times-Italic
- TimesItalic
- TimesNewRoman,Italic
- TimesNewRoman-Italic
- TimesNewRomanItalic
- TimesNewRomanPS-Italic
- TimesNewRomanPS-ItalicMT
- TimesNewRomanPSMT,Italic
Map to Times-BoldItalic
StandardFont.TimesBoldOblique- Times-BoldItalic
- TimesBoldItalic
- TimesNewRoman,BoldItalic
- TimesNewRoman-BoldItalic
- TimesNewRomanBoldItalic
- TimesNewRomanPS-BoldItalic
- TimesNewRomanPS-BoldItalicMT
- TimesNewRomanPSMT,BoldItalic
Map to Symbol
StandardFont.Symbol- Symbol
- SymbolMT
Map to ZapfDingbats
StandardFont.Dingbats- ZapfDingbats
Frequently Asked Questions
What is font management in PDFs and why is it important?
Font management in PDFs involves finding, adding, embedding, unembedding, and replacing fonts to ensure that text displays consistently across different platforms and devices. IronPDF offers comprehensive font management, which is crucial for maintaining the visual integrity and portability of PDF documents.
How can I embed fonts in a PDF using IronPDF?
You can embed fonts in a PDF using IronPDF by adding the font files to the PdfDocument instance and calling the Embed method. This ensures that the fonts are included in the PDF file, guaranteeing their availability when the document is opened on different systems.
Why should I consider embedding fonts in PDF documents?
Embedding fonts in PDF documents ensures that the text is rendered correctly on any device without requiring the fonts to be installed on the viewing system. This guarantees visual consistency, which is especially important for PDF/A compliance and international language support.
How do I find a specific font in a PDF using IronPDF?
To find a specific font in a PDF with IronPDF, use the PdfFontCollection object within the PdfDocument. You can specify the name of the font to retrieve font objects and inspect their properties, which is essential for maintaining font consistency during operations like text replacement.
What steps should I follow to add fonts to a PDF?
To add fonts to a PDF, you can use the Add method in IronPDF. This allows you to add standard fonts or external font files as byte data to a PDF document, facilitating precise control over the document's typography.
When is it beneficial to unembed fonts from a PDF?
Unembedding fonts from a PDF can be beneficial for reducing the file size, especially if the fonts are standard and widely available on most systems. However, ensure that the fonts have suitable fallbacks to avoid display issues post-unembedding, as visual rendering may be compromised otherwise.
What are the 14 standard PDF fonts supported by IronPDF?
The 14 standard PDF fonts, also known as Base 14 Fonts or Standard Type 1 Fonts, include Courier, Helvetica, Times-Roman, Symbol, and ZapfDingbats, among others. These fonts are universally supported in PDF viewers and do not require embedding, ensuring compatibility across various platforms.
How does IronPDF handle font replacement in PDFs?
IronPDF allows for font replacement where you can substitute one font for another while preserving the font's data structure, including styling and encoding. This is useful for standardizing fonts in a document, although slight visual differences may occur in some cases.
Can IronPDF manage web fonts and icon fonts in PDFs?
Yes, IronPDF provides comprehensive support for web fonts and icon fonts, accommodating modern typography needs. This is particularly advantageous when converting HTML to PDF, as IronPDF automatically handles web fonts incorporated in your HTML code.
How does IronPDF support PDF/A compliance concerning fonts?
IronPDF offers features to manage font embedding and consistency, critical for creating PDF/A compliant documents. By ensuring that fonts are properly embedded and displayed, IronPDF aids in meeting the standards required for long-term archiving of electronic documents.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.