Fill AcroForm - Fill PDF Form using C#

Fill Form Field in a PDF Document

To fill a form field, get the field from the Document object’s Form collection. then set the field value using the field’s Value property.

This example selects a TextBoxField and sets its value using the Value property.

// For complete examples and data files, please go to
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Forms();

// Open document
Document pdfDocument = new Document(dataDir + "FillFormField.pdf");

// Get a field
TextBoxField textBoxField = pdfDocument.Form["textbox1"] as TextBoxField;

// Modify field value
textBoxField.Value = "Value to be filled in the field";
dataDir = dataDir + "FillFormField_out.pdf";
// Save updated document