2012-02-08 43 views

回答

2

使用PdfStamper將PushbuttonField添加到現有PDF。指定頁面上的位置,字段的名稱和頁碼。

static void AddPushbuttonField(string inputFile, iTextSharp.text.Rectangle buttonPosition, string buttonName, string outputFile) 
{ 
    using (PdfStamper stamper = new PdfStamper(new PdfReader(inputFile), File.Create(outputFile))) 
    { 
     PushbuttonField buttonField = new PushbuttonField(stamper.Writer, buttonPosition, buttonName); 

     stamper.AddAnnotation(buttonField.Field, 1); 
     stamper.Close(); 
    } 
} 

您還應該看看iText in Action。 Chapter 8有創建按鈕字段的例子和許多您可以設置的不同屬性。

相關問題