Blog Post

How to fill PDF forms from a SharePoint list using Power Automate

Clavin Fernandes
Illustration: How to fill PDF forms from a SharePoint list using Power Automate

Document Converter for Power Automate has various actions that enable you to automate your document management workflows. This blog will show you how to fill out PDF forms using SharePoint list data and Nutrient’s Import PDF Forms data action in Power Automate. In addition to your free, full, or trial subscription, you also need a Power Automate account and appropriate privileges to create flows.

With Nutrient’s Import PDF Forms data action, you can import XML, FDF, and XFDF data in PDF forms. In this example, you’ll learn how to import XML data into a PDF form. Follow the steps below to see how to import all list items from a SharePoint list and import that data in a PDF form template.

Creating a Power Automate flow to export PDF form data as XML

fill pdf forms from sharepoint list

  1. Select the When a file is created or modified (properties only) trigger. Fill in the Site Address and Library Name fields.

  2. From the list of actions, choose Get file content using path.

  3. Fill in the Site Address and File Path fields.

fill pdf forms using power automate

  1. Search for the Muhimbi connector and select the Export PDF Forms Data action.

  2. Enter a source file name, and in the source file content field, from the list of dynamic content, choose File Content.

  3. The output data format should be XML.

export pdf form data as xml

Nutrient’s Processed file content returns a Base64 string, and you need to use the following formula to convert it:

base64ToString(outputs('Export_PDF_Forms_Data')?['body/processed_file_content'])

<?xml version="1.0" encoding="utf-8"?>
<fields xmlns:xfdf="https://ns.adobe.com/xfdf-transition/">
  <GivenNameTextBox xfdf:original="Given Name Text Box">Your name here</GivenNameTextBox>
  <FamilyNameTextBox xfdf:original="Family Name Text Box">Your family name here</FamilyNameTextBox>
  <Address1TextBox xfdf:original="Address 1 Text Box">Your address</Address1TextBox>
  <HousenrTextBox xfdf:original="House nr Text Box">Your housenr</HousenrTextBox>
  <Address2TextBox xfdf:original="Address 2 Text Box">Your second address</Address2TextBox>
  <PostcodeTextBox xfdf:original="Postcode Text Box">Your postcode</PostcodeTextBox>
  <CityTextBox xfdf:original="City Text Box">Your city</CityTextBox>
  <CountryComboBox xfdf:original="Country Combo Box">Your country</CountryComboBox>
  <GenderListBox xfdf:original="Gender List Box">Your gender</GenderListBox>
  <HeightFormattedField xfdf:original="Height Formatted Field">Your height</HeightFormattedField>
  <DrivingLicenseCheckBox xfdf:original="Driving License Check Box">Yes</DrivingLicenseCheckBox>
  <FavouriteColourListBox xfdf:original="Favourite Colour List Box">Yellow</FavouriteColourListBox>
</fields>

Now that you have the template as an XML file, the next step is to create a Power Automate flow to import the SharePoint list item to a PDF template.

How to import the SharePoint list item to a PDF template

  1. Create a new flow using the Build an instant cloud flow option and select the Manually trigger a flow trigger.

import sharepoint list in a pdf template

  1. Add the SharePoint Get items action to the flow canvas and configure it using the details below:

  • Site Address — Specify the path to the SharePoint Online site collection that holds the file.

  • List Name — Select the SharePoint list from which you want to get the items.

power automate flow to import lists

Note: If you have an extensive list, you might need to configure the action settings and turn the Pagination option to On and set the Threshold field to a site collection.

fill pdf forms from sharepoint list

  1. Add the SharePoint Get file content using path action to the flow canvas and configure it according to the details below:

  • Site Address — Specify the path to the SharePoint Online site collection that holds the form template.

  • File Path — Select the file path to your PDF form template.

paste xml template

  1. Add the Compose action to the flow canvas. Then:

  • Paste the XML template you exported in the Creating a Power Automate Flow to Export PDF Form Data as XML section above.

  • Insert the various list fields from the Get items action in the appropriate places between the >< elements in the XML.

If you have a Yes/No column in SharePoint, this will return True/False. If you want to change it into a checkbox field, you’ll need to convert it using the following formula:

if(equals(items('Apply_to_each')?['Your Field Internal Name'],True),'Yes','No')

fill pdf forms from sharepoint list

  1. Click Add an action and add the Nutrient Import PDF Forms data action to the flow canvas. Then fill in the following details:

  • Source file nameTitle.xml is the output of the Get items action.

  • Source file contentOutputs is the output of the Compose action.

  • PDF Form file contentFile Content is the output of the Get file content using path action.

  • Flatten — Change from Default to No to ensure the form is editable.

  • Read-only — Change from Default to No.

You can find the full details for the Import PDF Forms data action on the corresponding page. Or, refer to the guide and video tutorial on how to fill PDF forms using Power Automate.

import pdf form data

  1. Click Add an action, and add the Create file SharePoint action to create the PDF document in the SharePoint document library. This is the information you need to fill in the action fields:

  • Folder Path — Specify the output path to write the PDF file to.

  • File NameBase file name.pdf is the output variable of the Import PDF Forms data action.

  • File ContentProcessed file content is the output variable of the Import PDFs Form data action.

create pdf file

Now, start your flow manually, and after a few seconds, each list item from the SharePoint list will be imported into a template and all PDF forms will be generated in the destination library.

Author
Clavin Fernandes Developer Relations and Support Services

Clavin is a Microsoft Business Applications MVP who supports 1,000+ high-level enterprise customers with challenges related to PDF conversion in combination with SharePoint on-premises Office 365, Azure, Nintex, K2, and Power Platform mostly no-code solutions.

Explore related topics

Share post
Free trial Ready to get started?
Free trial