Fonts in IronPDF: Best Practices
Does IronPDF embed fonts?
All font (subsets) used inside your HTML are automatically embedded inside the PDF, assuming the Font embed property of the font is set to Editable. This ensures that the PDF is displayed with the same fonts, preventing any discrepancies.
Can IronPDF remove fonts?
Yes, IronPDF can remove fonts. Technically, it achieves this by unembedding the font. For more detailed instructions on how to manage and unembed fonts from PDFs, please visit the following How-to article: 'How to Manage Fonts in PDF'
// Example of code to unembed fonts from a PDF using IronPDF
using IronPdf;
// Load the existing PDF document
var pdf = PdfDocument.FromFile("existing-document.pdf");
// Remove fonts by unembedding them
pdf.UnembedAllFonts();
// Save the updated PDF document
pdf.SaveAs("document-without-embedded-fonts.pdf");
// Example of code to unembed fonts from a PDF using IronPDF
using IronPdf;
// Load the existing PDF document
var pdf = PdfDocument.FromFile("existing-document.pdf");
// Remove fonts by unembedding them
pdf.UnembedAllFonts();
// Save the updated PDF document
pdf.SaveAs("document-without-embedded-fonts.pdf");
' Example of code to unembed fonts from a PDF using IronPDF
Imports IronPdf
' Load the existing PDF document
Private pdf = PdfDocument.FromFile("existing-document.pdf")
' Remove fonts by unembedding them
pdf.UnembedAllFonts()
' Save the updated PDF document
pdf.SaveAs("document-without-embedded-fonts.pdf")
Can I embed an entire font in my PDF?
Yes, IronPDF allows you to embed fonts in your PDF documents. Embedding fonts ensures visual consistency, as the document will be displayed with the desired fonts regardless of whether they are installed on the viewer's system. Note that embedding fonts can increase the file size of the PDF. For more detailed instructions on how to manage and embed fonts in PDFs, visit the how-to article: 'How to Manage Fonts in PDF'
// Example of code to embed fonts in a PDF using IronPDF
using IronPdf;
// Create a new PdfDocument or load an existing one
var pdf = new IronPdf.HtmlToPdf().RenderHtmlAsPdf("<h1>Hello World</h1>");
// Ensure all fonts are embedded
pdf.SaveAs("document-with-embedded-fonts.pdf", new PdfSaveOptions
{
EmbedFonts.Enabled = true
});
// Example of code to embed fonts in a PDF using IronPDF
using IronPdf;
// Create a new PdfDocument or load an existing one
var pdf = new IronPdf.HtmlToPdf().RenderHtmlAsPdf("<h1>Hello World</h1>");
// Ensure all fonts are embedded
pdf.SaveAs("document-with-embedded-fonts.pdf", new PdfSaveOptions
{
EmbedFonts.Enabled = true
});
' Example of code to embed fonts in a PDF using IronPDF
Imports IronPdf
' Create a new PdfDocument or load an existing one
Private pdf = (New IronPdf.HtmlToPdf()).RenderHtmlAsPdf("<h1>Hello World</h1>")
' Ensure all fonts are embedded
pdf.SaveAs("document-with-embedded-fonts.pdf", New PdfSaveOptions With {.EmbedFonts.Enabled = True})