Fonts in IronPDF: Best Practices

This article was translated from English: Does it need improvement?
Translated
View the article in English

IronPDF 是否嵌入字體?

假設字體的嵌入屬性設置為可編輯,則使用於 HTML 中的所有字體(子集)均自動嵌入到 PDF 中。 這確保了 PDF 以相同的字體顯示,防止出現差異。

IronPDF 可以移除字體嗎?

可以,IronPDF 可以移除字體。 從技術上講,它通過取消嵌入字體來實現這一點。 有關如何管理和取消嵌入 PDF 中字體的更詳細說明,請訪問以下指南文章:'如何管理 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")
$vbLabelText   $csharpLabel

我可以在我的 PDF 中嵌入整個字體嗎?

可以,IronPDF 允許您在您的 PDF 文件中嵌入字體。 嵌入字體確保可視一致性,因為無論檢視者系統中是否安裝了字體,文件都將以所需字體顯示。 請注意,嵌入字體可能會增加 PDF 的文件大小。 有關如何管理和嵌入 PDF 中字體的更詳細說明,請訪問指南文章:'如何管理 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})
$vbLabelText   $csharpLabel
Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 16,154,058 | 版本: 2025.11 剛剛發布