IronPDF 中的字型:最佳實務

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 擁有卡爾頓大學(Carleton University)的電腦科學學士學位,專精於前端開發,並精通 Node.js、TypeScript、JavaScript 及 React。他熱衷於打造直觀且美觀的用戶介面,喜歡運用現代框架,並創建結構完善、視覺上吸引人的手冊。

除了開發工作之外,Curtis 對物聯網(IoT)抱有濃厚興趣,致力於探索整合硬體與軟體的創新方法。閒暇時,他喜歡玩遊戲和開發 Discord 機器人,將對科技的熱愛與創意相結合。

準備開始了嗎?
Nuget 下載 19,014,616 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronPdf
執行範例 觀看您的 HTML 轉為 PDF。