Cloud and Desktop flows a combination to manage PDF documents (Part 2)

In the previous blogpost we learned how to create multiple PDF files using a parent-child cloud flow structure and an online word template.

In this blogpost I will show you how we can merge those generated PDF files into one, I will also show you how to add a digital certificate to the merged file and how to upload it to SharePoint using a PowerShell script. All this using Power Automate Desktop.

That said, let me walk you through this second episode of a mini-series of blogposts to show you how PDF documents can be managed using cloud and desktop flows.

Prepare the local paths

You have already created a local path to store there the PDF files created from the cloud flow, however we still need to merge and sign them and for that we need local paths where to place those files, so it will be better if you separate each action in a local path:

In the image above I have created a folder to store the digital certificate that we will use in the desktop flow, then I have created another folder to place there the merged PDF files, the same for the signed PDF files. And finally another folder to store there the word template that we used before.

The Pending folder is where the cloud flow creates all the PDF files.

Digital Certificate

In a real project you don’t need to do this, but as for demo purposes then I will show you how you can generate your own certificate.

First is run PowerShell as administrator, and run the following 3 lines:

$cert = New-SelfSignedCertificate -DnsName -CertStoreLocation cert:\LocalMachine\My
$pwd = ConvertTo-SecureString -String “MyPassword” -Force -AsPlainText
Export-PfxCertificate -Cert $cert -FilePath “<change this to your certificate folder>\cert.pfx” -Password $pwd

Now the generated certificate should be in the certificate folder:

The next step is download a standalone app to sign a PDF file, there are several of this apps out there, nevertheless I used this one:

And in my case I put this executable in the same folder where the certificate is located:

Power Automate Desktop

The next step is to download and install Power Automate Desktop, you can download it from here:

After installing it. Then open it and log in with the same account used to create the cloud flow.

Finally choose the environment and click on New Flow:

In the desktop editor you will see on the left a list of all actions available, and let me tell you that list is really long, but for this case we will use a few ones, the first action to use is called Get files in folder:

For the next action, we need to create a variable of type List because that list will contain all the PDF files to merge:


The next action is to add a for each, this will help us to fill the list with each PDF file on the Pending folder:

When you add the for each action you have to specify that it will iterate Files which is the result of the first step, and you also have to specify in the iterate part the item to be added to the list, in this case is Currentitem.FullName:

The next action is optional, the Reverse List action is simply to get the same order of the events as they were processed by the cloud flow, if you skip this task the merged PDF file will contain all the events in the reverse order.

The next action is to create an input variable, the ContactName, this variable will help us to give the merged PDF file a proper name:


The next action is finally merging all the PDF files into one:

In the Merged PDF path you have to specify the path and name of the generated PDF, this is where we use the Merged folder and input variable created previously: