How to enumerate PDF Form Field Values in C# .NET Framework

Cloudmersive
1 min readJul 23, 2020

--

The first step when dealing with PDF form fields is a quick enumeration operation. Problem is, this is generally not so quick to get set up and working. Parsing PDF is not a fun task, requiring a great deal of special case logic and all that lovely stuff. So to help you out of this sticky situation, I will be showing you a simple method for using an API to enumerate PDF form fields in C#.

First, let’s go on NuGet and grab our package files:

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8

Hot on the heals of that, we have our function call:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;namespace Example{public class EditPdfGetFormFieldsExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new EditPdfApi();var inputFile = new System.IO.Stream(); // System.IO.Stream | Input file to perform the operation on.try{// Gets PDF Form fields and valuesPdfFormFields result = apiInstance.EditPdfGetFormFields(inputFile);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling EditPdfApi.EditPdfGetFormFields: " + e.Message );}}}}

And done!

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet