Fillable PDF Forms via C#

Сreate fillable PDF acroforms. Use Aspose.PDF for .NET to modify PDF files programmatically

How to Fill PDF Forms Using .NET Library

In order to fill PDF Forms (Acroforms) in a PDF file, we’ll use Aspose.PDF for .NET API, which is feature-rich, powerful, and easy-to-use document manipulation API for net platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

How to Fill AcroForm in PDF using C#


You need Aspose.PDF for .NET to try the code in your environment.

  1. Load PDF in an instance of Document class.
  2. Create a field in PDF file.
  3. Add field to the document.
  4. Save modified PDF

Fill AcroForm in PDF - C#

This sample code shows how to Fill PDF forms in PDF using C#

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

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

    // Step 3. Modify field value
    textBoxField.Value = "Value to be filled in the field";
    dataDir = dataDir + "FillFormField_out.pdf";

    // Step 4. Save updated document
    pdfDocument.Save(dataDir);