- 09 May 2022
- 2 Minutes to read
- Print
- DarkLight
Filling in PDF Forms Using Flow
- Updated on 09 May 2022
- 2 Minutes to read
- Print
- DarkLight
The Set PDF Form Fields component in a flow can populate a PDF form template with data. When used in a flow, this step reads a PDF form template to identify its fields, then provides input fields for populating the form data. This step does not actually create the file; it works in conjunction with the Create File step. The Get PDF Form Field Names step reads an input PDF file and returns the names of the Form fields. Set PDF Form Fields Dynamic allows a user to pass in a list of Data Pairs where the name is the field name, and the value is an object, and get a PDF File Data object to download/store.
Example
This example populates an example PDF.
The PDF Form template is designed with the following fields: Given Name, Family Name, Address 1, Address 2, Postcode, City, Country, Gender, Height (cm), and Favorite Colour. The example PDF also includes a field for the Driver's License and the languages spoken by the user including Deutsch, English, Français, Esperanto, and Latin, all of which are booleans.
- To begin, select CREATE FLOW from the bottom action panel.
- Name the Flow then select CREATE.
- From the Steps panel, expand Data > PDF and drag and drop a Set PDF Form Fieldsstep into the workspace.
- Connect the Start step to this step.
- With the Set PDF Form Fields step selected, click CHOOSE FILE to upload a PDF file into the Properties > CONFIGURATION > PDF File Example box.When using the Get PDF Field Names step, a separate step must be created for each field. Additionally, when using the Set PDF Form Fields Dynamic step, a user must select Build Array for the Field Data and then Build Data for each item they add. The item name will be a Constant value, and the output value should use Select From Flow.
- Notice under Properties > PDF Field Definitions that the field names are identified.
- Next, configure the Properties > Inputs for the Set PDF Form Fields step. In this example, Constant input mappings are used, but variables or merged text could also be used. The input fields will respect the data type of the PDF form field when mapping in the input data. For example, if a Form field in the PDF is numeric, establish compatible input for the field within the Set PDF Form Fields step. Within Inputs > PDF File, the mapping will be Constant and the same file will be input here to retain the example data.
- In the inputs there will be an input for PDF file, this is where the fields will be set.
- The Outputs section shows the name of the Set PDF Form Fields step output, which is of type FileData. This example retains the default value for the file data.
- This completes the configuration of the Set PDF Form Fields step.
Debug
- Select Debug from the top action bar. Run the Flow in the Debugger.
- Notice that the Flow runs successfully.
- Select the Set PDF Form Fields and choose View Input/Output Data. This shows the constant inputs that were mapped earlier.