原創|其它|編輯:郝浩|2012-10-17 16:43:37.000|閱讀 2378 次
概述:在Aspose.Pdf for .Net使用中,為表單字段設置/更新默認字體,需要用到一個新的構造函數DefaultAppearance,這個新類存在Aspose.Pdf.InteractiveFeatures名稱空間之下。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
在Aspose.Pdf for .Net使用中,為表單字段設置/更新默認字體,需要用到一個新的構造函數DefaultAppearance,這個新類存在Aspose.Pdf.InteractiveFeatures名稱空間之下。 為了使用這個新對象,將會用到Field class類的DefaultAppearance屬性。
C#
//open document Document pdfDocument = new Document("input.pdf"); // get particular form field from document Aspose.Pdf.InteractiveFeatures.Forms.Field field = pdfDocument.Form["textField"] as Aspose.Pdf.InteractiveFeatures.Forms.Field; // create font object Aspose.Pdf.Text.Font font = FontRepository.FindFont("ComicSansMS"); // set the font information for form field field.DefaultAppearance = new Aspose.Pdf.InteractiveFeatures.DefaultAppearance(font, 10, System.Drawing.Color.Black); //save updated document pdfDocument.Save("output.pdf");
VB.NET
'open document Dim pdfDocument As Document = New Document("input.pdf") ' get particular form field from document Dim field As Aspose.Pdf.InteractiveFeatures.Forms.Field = TryCast(pdfDocument.Form("textField"), Aspose.Pdf.InteractiveFeatures.Forms.Field) ' create font object Dim font As Aspose.Pdf.Text.Font = Aspose.Pdf.Text.FontRepository.FindFont("ComicSansMS") ' set the font information for form field field.DefaultAppearance = New Aspose.Pdf.InteractiveFeatures.DefaultAppearance(font, 10, System.Drawing.Color.Black) ' save updated document pdfDocument.Save("output.pdf")
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網