原創|其它|編輯:郝浩|2012-10-17 17:16:44.000|閱讀 404 次
概述:為了使用Aspose.Pdf for.Net在現有的PDF文件中填充表單字段,要使用到Form class。這個類提供了FillField方法允許您填補不同的字段。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
為了使用Aspose.Pdf for.Net在現有的PDF文件中填充表單字段,要使用到Form class。這個類提供了FillField方法允許您填補不同的字段。例如,你可以使用這種方法填寫一個文本字段或設置復選框和comob框值。首先,您需要創建一個輸入和輸出PDF文件參數的Form class類對象,然后調用FillField方法。在那之后,您需要調用Save方法來保存輸出PDF文件。
C#
//open document Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form("input.pdf", "output.pdf"); //Fill the field "Name" with "Mike". pdfForm.FillField("Name", "Mike"); //Choose the field "Gender" with "Male". pdfForm.FillField("Gender", "Male"); //Fill the field "Telephone". pdfForm.FillField("Telephone", "888.277.6734"); //Fill the field "Address". pdfForm.FillField("Address", "41, Lily Street, Hurstville, NSW, 2220 Australia "); //Choose the item "GradeTwo" of the Combo field "Grade". pdfForm.FillField("Grade", "GradeTwo"); //use case for unchecking the checkbox "Lodging". pdfForm.FillField("Lodging", "Off"); //save updated PDF pdfForm.Save();
VB.NET
'open document Dim pdfForm As New Aspose.Pdf.Facades.Form("input.pdf", "output.pdf") 'Fill the field "Name" with "Mike". pdfForm.FillField("Name", "Mike") 'Choose the field "Gender" with "Male". pdfForm.FillField("Gender", "Male") 'Fill the field "Telephone". pdfForm.FillField("Telephone", "888.277.6734") 'Fill the field "Address". pdfForm.FillField("Address", "41, Lily Street, Hurstville, NSW, 2220 Australia ") 'Choose the item "GradeTwo" of the Combo field "Grade". pdfForm.FillField("Grade", "GradeTwo") 'use case for unchecking the checkbox "Lodging". pdfForm.FillField("Lodging", "Off") 'save updated PDF pdfForm.Save()
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網