Convert InfoPath to PDF Using Power Automate

Stay informed about InfoPath deprecation and explore alternatives with our PDF converter solutions. Watch the recording of our latest webinar and learn how to convert your InfoPath documents using Power Automate, Nintex workflows, SharePoint Designer, and code.

In this guide, you’ll learn how to convert InfoPath files to PDF using Power Automate. Converting InfoPath to PDF is a more involved process than other conversion types, because InfoPath uses two files to create a single form: an XML (data) file, and an XSN (template) file.

In this example, you'll create a simple flow that's triggered whenever a form is added to a folder in a SharePoint Online library. Once this is added, the form is automatically converted to a PDF and stored in an MS SharePoint folder.

This example can easily be adjusted to use different file services (e.g. the trigger can be for files uploaded to OneDrive, Box.com, Dropbox, and Google Drive, or it can even be used to migrate your SharePoint On-Premises InfoPath forms to SharePoint Online).

Prerequisites

Ensure the following prerequisites are met:

Using Power Automate to Convert InfoPath Files to PDF

From a high-level perspective, the flow looks as shown in the image below.

convert infopath to pdf

Note: Converting an InfoPath form is similar to converting any other document type using Muhimbi's flow actions, but you'll also need to pass in the XSN file (the file content, not the URL to the file) alongside the XML file.

1: Creating a New Flow

Create a new flow and use the When a file is created trigger . Fill out the URL for the site address and select the relevant SharePoint library from the dropdown menu.

create flow

2: Getting the File Content

Insert the Get file content action and specify the path to the SharePoint Online location where the XSN has been published. By default, it's stored in the Forms folder, e.g. https://yourdomain.sharepoint.com/sites/Sitecollectionname/Library/Forms/template.xsn .

get file content

3: Converting the Document

Insert Muhimbi’s Convert InfoPath document action, and fill it out as follows.

  1. Default — If this is selected, the attachments are merged into the output file, and unsupported attachments are removed.
  2. Merge — If this is selected, the supported attachments are merged to the output PDF.
  3. Unsupported attachments — If this is selected, the behavior will be determined according to the settings in InfoPathConverterFullFidelity.UnsupportedAttachmentBehaviour .
  4. AttachAsPDF — If this is selected, supported attachments are converted into PDF and attached to the output document.
  5. AttachOriginal — If this is selected, all attachments are attached to the output document in their original format.
  1. Error — When this option is selected, an error is raised when unsupported attachments are found.
  2. Remove — When this option is selected, the unsupported attachments are ignored and not included in the output.
  3. AttachOriginal — When this option is selected, unsupported attachments are attached in their original format.

fail on error

Note: Don't just pass the path to the XSN file into the Muhimbi action, as it doesn’t have the privileges to read the file.

4: Creating a File

Insert a Create file action to write the converted file back to the OneDrive folder where the converted PDF files are written. In the Folder Path field, specify the path to the OneDrive folder. In the File Name field, pass in the Base file name field returned by the Convert document action, along with the .pdf suffix. In the File Content field, pass the Processed file content returned by the Convert document action.

convert document

You can write the converted file back to the OneDrive folder, Dropbox, or Google Drive, or you can send the PDF via email.

5: Publishing the Workflow

Publish the workflow and upload a Microsoft InfoPath file in the specified document library. After a few seconds, the flow will trigger and a PDF file will be generated.

Note that this is just a basic example. Muhimbi PDF Converter also comes with the ability to convert files attached to InfoPath forms, as well as the ability to choose which InfoPath view or views to convert. For more information, contact us.

Additional Resources

For more information, refer to the following resources.