Aspose.Pdf控件可以通过简单的代码进行PDF文件的创建、修改、注释、转换等操作,在创建PDF文件时,如果需要使用到Adobe Reader支持的14种字体以外的字体,就必须要把用到的字体嵌入到生成的PDF文件里,如何字体信息没有被嵌入,Adobe Reader将会从操作系统里获取,控件提供了IsEmbedded属性来设置字体是否被嵌入,具体的使用方法可以参考下面的部分代码:
// For complete examples and data files, please go to https://github.com/aspose-pdf/
Aspose.Pdf-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();
// Instantiate Pdf object by calling its empty constructor
// Create a section in the Pdf object
Aspose.Pdf.Text.TextSegment segment = new
Aspose.Pdf.Text.TextSegment(" This is a sample text using Custom font.");
ts.Font = FontRepository.FindFont("Arial");
ts.Font.IsEmbedded = true;
segment.TextState = ts;
fragment.Segments.Add(segment);
page.Paragraphs.Add(fragment);
dataDir = dataDir + "EmbedFontWhileDocCreation_out_.pdf";
// Save PDF Document
doc.Save(dataDir);