IronPDF中的字體:最佳實踐
Curtis Chau
Updated: 2026年4月22日
IronPDF會嵌入字體嗎?
假設字體的嵌入屬性設置為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
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")我可以在我的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
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})
技術作家
Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。
...
閱讀更多