Fill AcroForm - Fill PDF Form using C#
Contents
[
Hide
]
The following code snippet also work with Aspose.PDF.Drawing library.
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 https://github.com/aspose-pdf/Aspose.PDF-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
// Open document
Document document = new Document(dataDir + "FillFormField.pdf");
// Get a field
TextBoxField textBoxField = document.Form["textbox1"] as TextBoxField;
// Modify field value
textBoxField.Value = "Value to be filled in the field";
// Save updated document
document.Save(dataDir + "FillFormField_out.pdf");