Examples

Acroform filling in PDF (.NET Core/Framework)

In the following examples you will learn how to fill the form fields and to reorganize and fill the fields by appending name prefixes when merging a PDF.

How to fill an Acroform PDF Document

Download the NuGet package and GitHub project to get started. The following steps illustrates filling Acroform form fields of a PDF document using the DynamicPDF Merger product. 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( "Source.pdf" );
document.Form.Fields["TextBox1"].Value = "My Text"; // TextBox field
document.Form.Fields["CheckBox1"].Value = "Yes"; // CheckBox field
document.Form.Fields["ComboBox1"].Value = "Item4"; // ComboBox field
document.Form.Fields["RadioButton1"].Value = "Item2"; // RadioButton field
ListBoxField listBox = (ListBoxField) document.Form.Fields["ListBox1"]; // ListBox field
listBox.SetValues( new string[] { "Item1", "Item3", "Item5" } );
document.Draw( "output.pdf" );

How to do Acro Form filling and reorganizing in C#

Below are the steps and sample code to merge two PDF documents containing Acro Form fields and reorganize their names with name prefixes.

Steps for appending prefix to form field 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" );

Getting Started

NuGet Package

Download DynamicPDF Merger NuGet ceTe.DynamicPDF.CoreSuite.NET package. The Core Suite includes the DynamicPDF Generator, DynamicPDF Merger, and DynamicPDF ReportWriter.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

GitHub Example Project

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

Clone or View Example Project on GitHub

DynamicPDF Merger Information

More information can be found here:

Java and COM/ActiveX Platforms

The DynamicPDF Merger is also available for Java and COM/ActiveX. 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 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

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