The 'Get PDF Form Data' action extracts data from a filled PDF document and returns the data in JSON format allowing further actions to be undertaken.
Please refer to the following article detailing an example of how to extract PDF Form data and create items within a SharePoint list: Extracting PDF form data using Microsoft Flow
The default 'Get PDF Form Data' flow action parameters are detailed below:
- File Content: A Base64 encoded representation of the PDF file.
Please refer to the Obtaining the 'File Contents' Parameter article for guidance on how to obtain the 'File Content' parameter ready to provide to an Encodian flow action.
The advanced 'Get PDF Form Data' flow action parameters are detailed below:
- Operation ID: (Advanced) The ID of a parent operation, please refer to: Flow Action Return Options: File Content vs. Operation ID
The 'Get PDF Form Data' flow action returns extracted data in JSON format contained within the 'Form Data' variable, an example payload is provided below for reference:
"Manager Name": "Jay Goodison",
"Total Days Requested": "4",
"Employee Signature": null,
"Employee Name": "Bill Gates",
"Send Form": null,
"Request Date": "9/6/19",
"Date To": "10/1/19",
"Date From": "10/4/19"
Parse JSON in Microsoft Flow
Follow these steps to parse the JSON returned by the 'Get PDF Form Data' action:
1. Create a Flow which passes a PDF Form to the 'Get PDF Form Data' action.
2. Execute the flow, and then click on the 'Get PDF Form Data' action
3. Under OUTPUTS, click 'Click to download'
4. Depending on your browser; the JSON payload will either download as a file or open within a new browser tab. We use Firefox's developer edition browser which opens the JSON file in a new browser tab.
5. Locate and obtain the value of the Form Data node.
NOTE: You'll need to use a text editor or similar to remove the escape characters (\) from the JSON or simply use an online service such as https://www.freeformatter.com/json-escape.html to do this for you.
6. Add a 'Parse JSON' action below the 'Get PDF Form Data' action
7. Content: Select the Form Data field from the 'Get PDF Form Data' action
8. Click 'Use sample payload to generate schema'
9. Paste the form data sample obtained in step 5 into the textarea control, click 'Done'
10. Add another action related to what you wish to do with the extracted data. The example below shows adding the extracted data into a SharePoint list.
The 'Get PDF Form Data' flow action returns the following data.
Standard Return Values
- Form Data - The data extract from the form in JSON format.
- Filename - An automatically assigned filename.
- FileContent - The original PDF document content (Base 64).
- OperationId - The unique ID assigned to this operation.
- HttpStatusCode - The HTTP Status code for the response.
- HttpStatusMessage - The HTTP Status message for the response.
- Errors - An array of error messages should an error occur.
- Operation Status - Indicates whether the operation has completed, has been queued or has failed.