IronPDF中的字體:最佳實踐

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

IronPDF是否嵌入字體?

假設字體的 Font embed 屬性設定為 Editable,則 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");
$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
});
$vbLabelText   $csharpLabel
Curtis Chau
技術作家

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

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

準備好開始了嗎?
Nuget 下載 17,803,474 | 版本: 2026.3 剛剛發布
Still Scrolling Icon

還在滾動嗎?

想快速取得證據? PM > Install-Package IronPdf
運行範例看著你的HTML程式碼變成PDF檔。