Pdf Fill Form Fields
Overview
This module contains Java Actions to read, fill in or update fields in a pdf file.
These form fields can be of type text or checkbox (choices in pdf forms are checkboxes as well).
Use cases examples:
- Generating pdf documents from your pre-defined pdf templates by filling the template data fields with the actual data. For example business proposals, invoices, delivery notes, etc.;
- Automatically pre-filling official digital pdf documents with data from Mendix;
- Automatically validating and processing contract and client data in Mendix by reading the data out of your pdf forms that your clients have completed (and uploaded or send to you by email);
Documentation
Functionality
This module contains Java Actions to read, fill in or update a pdf file containing form fields.
These form fields can be of type text or checkbox. (choices in pdf forms are checkboxes as well).
The Java Action to fill in the fields is JA_UpdateFields.
There is also the Java Action JA_GetFields to retrieve the name of all the fields as well as the current values. The name is needed when you want to fill in (update) a field.
Domain Model
The domain model contains several supporting entities.
Only two of them are persistent, so they can be stored when necessary: Field and PossibleValue.
The entity Field contains the field definition, which is the output of JA_GetField and JA_GetFields.
Storing this information enables you to associate a field definition with an entity of your own domain model.
This is not needed, so only do this when it is required for your specific functionality.
Tip: you can extend this Field entity when you want to store more information (e.g. page number where the field is located).
IDE Integration
The module integrates with the Mendix Studio Pro IDE, so these Java Actions appear in the Toolbox menu under the new group "Pdf Form Editor". They can be dragged and dropped in a Microflow and are graphical represented by their own pdf icon.
Problems
Be aware that when there is logic inside the pdf (javascript), this logic can interfere with the fields you want to fill in, especially when this javascript disables or enables fields, changes field values or empties fields.
The solution is to strip off this logic, the javascript, from the pdf. You can easily do this with the licensed version of the Adobe Pdf Editor.
Dependencies
These Java Actions in Mendix use custom java which is located in a java archive, a jar file:
- pdfeditor version 1.01
This jar needs other jar files (dependencies) which are included in the module:
- commons-logging version 1.2
- pdfbox version 2.0.22
- fontbox version 2.0.22
Screenshot Descriptions
Descriptions of the screenshots below this section:
- The domain model in Mendix Studio Pro
- Example of usage in a microflow in Mendix Studio Pro
- Pdf Form Editor integration in the Toolbox of Mendix Studio Pro
- Example of usage: pdf of the Dutch tax authorities with form fields which are filled by Mendix