How to use Power Automate to Convert OneDrive files to PDF

Clavin Fernandes

Clavin Fernandes

As part of our ongoing series about using the Muhimbi PDF Converter REST-based API in combination with Microsoft Flow, LogicApps and PowerApps, we present a simple yet powerful example for automatically converting files to PDF when they are added to OneDrive.

For those not familiar with the product, the Muhimbi PDF Converter REST-based API is a popular product to PDF Convert, Merge, Watermark, Secure and OCR files from Microsoft Flow, LogicApps, PowerApps as well as your own code using C#, Java, Python, JavaScript, PHP, Ruby and most other modern platforms. Leave a message below or contact us if you have any questions.

In this example we’ll show how to create a simple Flow that is triggered whenever a file is added to a folder in OneDrive. Once added, the file is automatically converted to PDF and stored in a different OneDrive folder. No need to install any local PDF Conversion software, all that is needed is the standard OneDrive sync client.

Remember that this is just an example, it can easily be modified to use different file services (e.g the trigger can be for files uploaded to SharePoint,, DropBox, Google Drive etc) and the resulting file can be written (or emailed) via any of the 100+ available Flow services. Convert newly added DropBox files to PDF and store the PDF copy in Google Drive, SharePoint AND send it via email? No problem! I don’t know why you’d want to do it, but this is a very flexible system.

There are many reasons for building a workflow like this one. We actually use this internally as a general-purpose PDF Converter. Office staff can drop any of the support file formats in a local folder, which is automatically synced with OneDrive using the standard OneDrive client. This triggers the flow and the converted file is written back to OneDrive and immediately synced back to the local system. Even though we wrote the underlying technology, it still looks like total magic.

From a high level, the Flow works as follows:

Convert to OneDrive - Overview

The full Flow can be found below. It is automatically created by the Flow Template named Automatically convert newly added OneDrive files to PDF, it is just a matter of filling out the blanks, specifically:

  • When a file is created – Folder: Specify the path to the OneDrive folder to monitor for new files.
  • Create a file – Folder path: Specify the path to the OneDrive folder where the converted PDF files are written to. Please make sure this folder is different from the input folder to prevent recursive flows. (Otherwise the converted PDF file will kick off the same flow, which in turn will create a copy of the same PDF file that will kick off the same flow again etc).

Convert to OneDrive - Detail - Part1Convert to OneDrive - Detail - Part2

That’s it, now publish the Flow and copy a file to the source folder. Assuming the OneDrive client is active, after a few moments a PDF file will appear in the destination folder.

For more details about using Muhimbi’s Flow actions, see the Core Concepts knowledge base article as well as all other Flow related posts.

If you have any questions about extending this Flow / template, or implementing it in your environment, then please leave a message below or contact our friendly support desk. We are here to help.

Labels: Articles, Flow, OneDrive, pdf, PowerApps, Workflow


Clavin Fernandes

Clavin Fernandes

Developer Relations and Support Services @ PSPDFKit

Clavin Fernandes is a Microsoft Business Applications MVP and works in Developer Relations and Support Services for PSPDFKit.

Have a Question?
We’re Always Happy to Help.

© Muhimbi Ltd. 2008 - 2024
This website uses cookies to ensure you get the best experience. Learn more