Retrieving Form Field location in PDF (.NET Core/Framework)

Retrieving Form Field location in PDF using DynamicPDF Merger is simple and easy.

How to Retrieve Form Fields in C#

The following steps and sample code illustrate retrieving Form Field location in PDF using DynamiicPDF Core Suite.

Steps for Retrieving Form Field Location in PDF

  1. Create a PdfDocument object with the desired pdf.
  2. Create a MergeDocument object with the desired pdf.
  3. Create a Page and add it to the MergeDocument instance.
  4. Create a Image object.
  5. Set the height and width of image with PdfDocument form field's height and width respectively.
  6. Add the image to the Page instance.
  7. Save the MergeDocument instance.

Sample Code - C#

PdfDocument pdfDocument = new PdfDocument("myDocument.pdf");
MergeDocument document = new MergeDocument("output.pdf", MergeOptions.None);
Page page = document.Pages[0];
Image image = new Image("image.gif", 0, 0);
image.X = pdfDocument.Form.Fields["PlaceHolderField"].GetX(page);
image.Y = pdfDocument.Form.Fields["PlaceHolderField"].GetY(page);
image.Height = pdfDocument.Form.Fields["PlaceHolderField"].Height;
image.Width = pdfDocument.Form.Fields["PlaceHolderField"].Width;

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!