How to Start Convert PDF Read PDF Edit PDF PDF Report Builder Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

Using C# PDF SDK
C# PDF Builder: How to add form fields to PDF file


C# Demo Code to add a form fields to adobe pdf file













Add text box form field


String outputFilePath = Program.RootPath + "\\" + "Sample91.pdf";

Document document = new Document();

PDFBuildHandler.Create(document, outputFilePath);

document.Open();

document.Add(new Paragraph("This is a sample for Text Form Field:"));
document.Add(new Paragraph(" "));

//  create a Text Box form field
FormFieldTextBox textBox = new FormFieldTextBox("TextBox1");
textBox.Text = " ";
textBox.Width = 400;
textBox.Height = 100;
//  add form field
document.Add(textBox);

document.Close();




Add check box form field


String outputFilePath = Program.RootPath + "\\" + "Sample92.pdf";

Document document = new Document();

PDFBuildHandler.Create(document, outputFilePath);

document.Open();

document.Add(new Paragraph("This is a sample for Text Form Field:"));
document.Add(new Paragraph(" "));

//  create a Text Box form field
FormFieldCheckBox checkbox = new FormFieldCheckBox("CheckBox1");
checkbox.Text = " ";
checkbox.Width = 50;
checkbox.Height = 50;
//  add form field
document.Add(checkbox);

document.Close();