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擁有卡爾頓大學電腦科學學士學位,專長於前端開發,精通Node.js、TypeScript、JavaScript和React。他熱衷於打造直覺美觀的使用者介面,喜歡使用現代框架,並擅長撰寫結構清晰、視覺效果出色的使用者手冊。

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

準備好開始了嗎?
Nuget 下載 17,012,929 | 版本: 2025.12 剛剛發布