cancel
Showing results for 
Search instead for 
Did you mean: 
anton-khrit

How to merge PDF files in Microsoft Flow, Azure Logic Apps and PowerApps

This article demonstrates how to merge PDF files with the help of Microsoft Flow and Plumsail Documents connector.

 

Before starting, ensure that you added Plumsail Documents connector to Microsoft Flow.

 

In this example, we will read three DOCX files from a specific folder, convert these files to PDF, merge them and send the result PDF file by email.

 

For instance, it may be useful in a situation when a few employees prepare different sections of a contract at the same time. They load the parts of the contract to a folder, then all files from this folder are merged to form the final document.

 

We will use Merge PDF action to combine documents.

 

Our source DOCX files have to be stored somewhere. Microsoft Flow has a lot of connectors for different systems. Here are just a few of them:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

In this example, we will store our source DOCX files in SharePoint in a library that we named Source Files Library, but you can get data from other sources. You may use these links to download 3 sample DOCX files: 1, 2, 3.

 

Merging PDF files

 

Here, we will guide you step by step through creating the flow. You also will find a screenshot of the complete flow at the end of the article.

 

Flow trigger

 

You can actually pick any trigger. For example, you can start Flow on file creation in a SharePoint document library. We use Manually trigger a flow trigger here to simplify the Flow.

 

Flow trigger

 

Get files (properties only)

 

We start with getting properties of all our DOCX files stored in a specific folder - Source Files Library. In the next step, we will iterate through the output from this action to get those files contents.

 

Get files (properties only) action

 

You can use any other connector to get files from your system.

 

Initialize variable

 

We need to prepare an array of files, that we will put in Plumsail Documents - Merge PDF action when composing the final document.

 

Add a new action and search for Variables - Initialize variable action. Enter a name for the variable and choose the Array type for it.

 

Initialize variable

 

Get file content using path

 

Now, you need to add Get file content using path action to get source DOCX files contents.

 

Click File Path field and add there Folder Path and File name with an extension from a menu on the right. This will automatically transform this action into repeating one which will be performed for each file from the source folder.

 

Get file content using path

 

Convert DOCX to PDF

 

This is an action from Plumsail Documents connector.

Put here File content from the output of the previous action.

Convert DOCX to PDF

 

You can find more detailed information about Convert DOCX to PDF action here.

 

Append to an array variable

 

Now, add Variables - Append to array variable action, enter an element of the array into the Value field as shown in the screenshot below. Result file here is the output from the previous operation:

Append to array variable

 

The array of PDF files is ready, now we can move to the main step - merging PDFs into the final document.

 

Merge PDF

 

This is an action from Plumsail Documents connector.

 

Click a small array icon on the right to switch to the view where you can input an entire array. Add the Array of the PDF files you received in the loop to the Content of PDF documents field:

 

Merge PDF
 
You can find more detailed information about Merge PDF action here.

 

Send an Email

 

Once the result file is generated, we send an email using Office 365 Outlook - Send email action. In the Attachments section, we add a name and the extension for the merged PDF file and choose Result file output from the previous Merge PDF action.

 

Send an Email

 

So, here is the complete flow:

 

Complete flow

 

Conclusion

 

That is all, the flow is configured. Hope, these steps will help to ease the work with documents.

 

This article was originally published here.

Comments
About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/