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.
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, Box.com, 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:
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).
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.
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.