Skip to main content

Acro Form Filling

Version: 12.0

Filling a PDF AcroForm

Use DynamicPDF Core Suite for .NET to fill in the fields of a PDF AcroForm programmatically and reorganize fields by appending name prefixes when merging a PDF using DynamicPDF Core Suite for .NET. The following C# examples illustrate filling and reorganizing an AcroForm.

Watch the Video​

YouTube thumbnail: Watch video: How to Fill a PDF AcroForm in .NETWatch video: How to Fill a PDF AcroForm in .NET

How to Fill AcroForm​

The following steps and C# sample code illustrate how to fill a PDF AcroForm programmatically using DynamicPDF Core Suite for .NET. pdf with fieldnames

Steps for Filling an AcroForm​

  1. Create a new MergeDocument instance.
  2. Set the field values by specifying the field name and the desired value.
  3. Add the Draw method to output the PDF document.

Sample Code - C#​

MergeDocument document = new MergeDocument(Util.GetPath("Resources/PDFs/fw9AcroForm_18.pdf"));
document.Form.Fields["topmostSubform[0].Page1[0].f1_1[0]"].Value = "Any Company, Inc.";
document.Form.Fields["topmostSubform[0].Page1[0].f1_2[0]"].Value = "Any Company";
document.Form.Fields["topmostSubform[0].Page1[0].FederalClassification[0].c1_1[0]"].Value = "1";
document.Form.Fields["topmostSubform[0].Page1[0].Address[0].f1_7[0]"].Value = "123 Main Street";
document.Form.Fields["topmostSubform[0].Page1[0].Address[0].f1_8[0]"].Value = "Washington, DC 22222";
document.Form.Fields["topmostSubform[0].Page1[0].f1_9[0]"].Value = "Any Requester";
document.Form.Fields["topmostSubform[0].Page1[0].f1_10[0]"].Value = "17288825617";
document.Draw("output.pdf");


A completed PDF form.

How to Reorganize and Fill AcroForm​

The following steps and C# sample code illustrate using DynamicPDF Core Suite for .NET to merge two PDF documents containing AcroForms and then reorganizing the combined AcroForm field names with name prefixes.

Steps for Reorganizing and Filling an AcroForm​

  1. Create a MergeDocument instance, and in the constructor, specify a MergeOptions instance that specifies a prefix for its form fields.
  2. Append a second PDF document to the MergeDocument instance and specify a MergeOptions instance that specifies a prefix for its form fields (unique from the previous form's prefix).
  3. Set the field values using the new unique names (prefix and original names).
  4. Add the Draw method to output the PDF document.

Sample Code - C#​

MergeDocument document = new MergeDocument("fw9AcroForm_18.pdf"), new MergeOptions(true, "fw_9A"));
document.Append("fw9AcroForm_18.pdf"), new MergeOptions(true, "fw_9B"));
document.Form.Fields["fw_9A.topmostSubform[0].Page1[0].f1_1[0]"].Value = "Any Company A, Inc.";
document.Form.Fields["fw_9A.topmostSubform[0].Page1[0].f1_2[0]"].Value = "Any Company A";
document.Form.Fields["fw_9B.topmostSubform[0].Page1[0].f1_1[0]"].Value = "Any Company B, Inc.";
document.Form.Fields["fw_9B.topmostSubform[0].Page1[0].f1_2[0]"].Value = "Any Company B";
document.Draw("output.pdf");

GitHub Project​

An example project is available on GitHub (examples.dynamicpdf-core-suite-dotnet-core). Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. This specific example discussed on this page are all contained in following classes on GitHub

View source on GitHub: Core Suite .NET Core Examples

Getting Started​

Get started easily by installing DynamicPDF Core Suite for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing the product.

NuGet Package​

The easiest way to install DynamicPDF Core Suite is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.

Get ceTe.DynamicPDF.CoreSuite.NET from NuGet

DynamicPDF Core Suite for .NET Information​

DynamicPDF Core Suite for .NET combines creating, merging, and visual report creation into one powerful product for creating PDF documents. It is ideal for anyone who needs to generate PDF documents or reports or work with existing PDFs in their applications. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Core Suite for .NET today!

More Information on Filling AcroForms​

Available on Other Platforms​

DynamicPDF Core Suite is also available for the Java and COM/ActiveX platforms. Refer to the respective product pages for more details.