Since TX Text Control X16, the Adobe PDF import filter is able to import form fields. Interactive forms in the Adobe PDF format are also known as AcroForm - the de-facto standard for PDF forms processing. Internally, the forms structure of a PDF document can be imported using the Adobe PDF import functionality of TX Text Control.
We just published a GitHub project that shows how to process the output of the PDF import process using an extension in the DocumentServer namespace. We implemented all base classes and inherited classes of supported form field elements:
After adding a reference to the TXDocumentServer.Forms project, a PDF form can be imported using the following code:
The static ImportForms method returns a list of AcroForm objects:
The list of AcroForm objects contains all types of contained form fields. In order to access the properties, they can be casted to their special type. The following code loops through all elements in order to read the options of contained combo boxes:
This new feature allows you to import forms that have been sent to users for completion in order to analyze and process the forms automatically.
The following Windows Forms sample project uses a pre-compiled version of the extension and comes with a sample PDF document.
Download the sample project, open it in Visual Studio 2017 and start the application.
Click the button Import Forms and select a PDF file you would like to import. A sample PDF named fw9.pdf is shipped with the project.
The sample loops through all elements in order to write the element type, name and value into a text box.
You can download the full extension sources from the GitHub project below.
Download and Fork This Sample on GitHub
We proudly host our sample code on github.com/TextControl.
Please fork and contribute.
Requirements for This Sample
- Visual Studio 2017 or better
- Any TX Text Control .NET X16 (trial sufficient)