In this guide you’ll learn how to automatically generate a PDF using Power Automate.
For this specific example we automatically generate a PDF file when a new MS Word document is added to a OneDrive folder. Once the file has been generated in OneDrive, we then automatically add it to a specified location within SharePoint.
It’s important to note that you are not limited to generating PDFs from MS Word documents - we support a wide range of file types. You can also generate your PDF on your desired platform like Dropbox, Google Drive, or any platform supported by Power Automate. If desired, you can extend our example by adding additional automation like sending the generated PDF in an email.
Before we begin. please make sure the following prerequisites are in place:
- An Office 365 subscription with Flow and OneDrive for Business support.
- Muhimbi PDF Converter for Power Automate full or free trial subscription.
- Appropriate privileges to create Flows.
- Appropriate privileges in MS SharePoint Online and OneDrive for Business. Working knowledge of Microsoft Flow.
Generate PDF from file created in OneDrive (Business) and add to SharePoint
This example takes you through generating a PDF when a file is created in OneDrive (Business) and then adding the generated file to SharePoint.
On a high level, the Flow will look like this:
Create a new Flow and use the OneDrive (Business) trigger ‘When a file is created’.
Folder: Select the OneDrive folder where the files to be converted will be uploaded.
Insert Muhimbi's ‘Convert document’ action and fill it out as per below:
Source file name: ‘File name’ of the output of ‘When a file is created’ action. Source file content: ‘File content’ of the output of ‘When a file is created’ action. Output format: PDF
Insert a SharePoint ‘Create file action’ to write the generated file to a SharePoint Online location.You can also use providers like Dropbox, OneDrive, Google Drive, or send the PDF via email.In our case, we have used MS SharePoint provider. Fill the action as per below:
Site Address: Select the location of the MS SharePoint site where you want to store the converted PDF document. Folder Path: Select the folder where you want the generated PDF file to be saved. File Name: ‘Base file name’ of the output of Muhimbi’s ‘Convert document’ action. Ensure you add the extension ‘.pdf’ to the file name. File Content: ‘Processed file content’ of the output of Muhimbi’s ‘Convert document’ action.
Publish the workflow and upload a new item such as MS Word document to the OneDrive (Business) location.
After a few seconds the Flow will trigger and a PDF file will be generated and uploaded to the MS SharePoint location.