Examples

Acroform Filling in a PDF

The following examples illustrate filling form fields and how to reorganize and fill the fields by appending name prefixes when merging the PDF.

Watch the Video

How to Fill an Acroform PDF Document

The following steps illustrates filling Acroform form fields of a PDF document using DynamicPDF Core Suite. Acroform form field values are set to the field by accessing the field using its name. The value that is specified must match the form field export value in order to select the field (ex: check box, radio button etc). Unicode values are fully supported.

Steps for setting values on a merged Acroform in PDF

  1. Create a MergeDocument object.
  2. Set the field values.
  3. Save 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(Util.GetPath("Output/AcroFormFilling.pdf"));

How to do AcroForm Filling and Reorganizing in C#

The following steps and sample code illustrates merging two PDF documents containing Acro Form fields and reorganizing their names with name prefixes.

Steps for Appending a Prefix to Form Feld Names and Fill

  1. Create a MergeDocument object with a MergeOptions object that specify a prefix for form fields.
  2. Append a second pdf document into the MergeDocument with a MergeOptions object that specify a prefix for form fields.
  3. Set the field values using both prefixes and name (new name).
  4. Save the PDF document.

Sample Code - C#

MergeDocument document = new MergeDocument( "source.pdf", new MergeOptions( true, "fw_4" ) );
document.Append( "source.pdf", new MergeOptions( true, "fw_9" ) );
document.Form.Fields["fw_4.FirstName"].Value = "John";
document.Form.Fields["fw_9.FirstName"].Value = "John";
document.Draw( "output.pdf" );

GitHub Project

Clone or view the example project at GitHub. This example code is contained in the Examples/AcroFormFilling.cs file.

Clone or View Example Project on GitHub

Getting Started

NuGet Package

DynamicPDF Core Suite is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The easiest way to install the package is through the Visual Studio Package Manager. You can also download the package directly from NuGet.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Core Suite Information

More information can be found on the DynamicPDF Core Suite webpage.

Available on Other Platforms

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

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!