Fonts

Does IronPDF embed fonts?

All font (subsets) used inside your HTML are automatically embedded inside PDF. (Assuming the Font embed property of the font is set to Editable).

Can IronPDF remove fonts?

Yes, IronPDF can remove fonts. Technically, it unembeds the font. Please visit the following How-to article to learn more about fonts: 'How to Manage Fonts in PDF'

:path=/static-assets/pdf/content-code-examples/how-to/manage-font-unembed-font.cs
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()
VB   C#

Can I embed an entire font in my PDF?

Yes, IronPDF can embed fonts. Embedding fonts in PDFs ensures visual consistency without requiring font installation but will increase file size. Please visit the following How-to article to learn more about fonts: 'How to Manage Fonts in PDF'

:path=/static-assets/pdf/content-code-examples/how-to/manage-font-embed-font.cs
using IronPdf;
using IronPdf.Fonts;
using System.Linq;

// Import PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");

// Select which font to embed
PdfFont targetFont = pdf.Fonts["MyCustomFont"];

// Add the font
byte[] fontData = System.IO.File.ReadAllBytes("dir/to/font.ttf");
pdf.Fonts.Add(fontData);

// Embed the font
pdf.Fonts.Last().Embed(fontData);
Imports IronPdf
Imports IronPdf.Fonts
Imports System.Linq

' Import PDF
Private pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")

' Select which font to embed
Private targetFont As PdfFont = pdf.Fonts("MyCustomFont")

' Add the font
Private fontData() As Byte = System.IO.File.ReadAllBytes("dir/to/font.ttf")
pdf.Fonts.Add(fontData)

' Embed the font
pdf.Fonts.Last().Embed(fontData)
VB   C#