In this blog post we will demonstrate how to convert an HTML file to PDF with the help of a Muhimbi Microsoft Flow Action.
Note that this is different from converting SharePoint Online Pages or List Items. An example for that scenario can be found here.
Please make sure the following prerequisites are in place:
- An Office 365 subscription with a SharePoint Online license.
- PDF Converter Services Online Full, Free or Trial subscription (Sign up).
- Appropriate privileges to create Flows.
In this example, we will store our HTML file in SharePoint Online, our Flow will be triggered when the HTML file is created in the document library. The Flow will convert the HTML file to PDF and then store the generated PDF file back in a document library.
From a high-level, our Flow will looks as follows:
- Add the “When an item is created or modified” SharePoint trigger.
- In the trigger, specify the path to the document library that should be monitored for new files.
- Add the Muhimbi “Convert HTML to PDF” action to the Flow Canvas.
- Add the “File Content”, returned by the trigger, to the “Source URL or HTML” field.
Step 3: Use the “Create file” SharePoint action to write the generated PDF document to the output document library.
- File name: For this Demo, we will create a dynamic file name using the formula concat(‘PDFfrmHTML’,utcNow(),’.pdf’).
- File Content: Processed file content is the output variable of the “Convert HTML to PDF” action.
Please make sure the output library is different from the input library. This will prevent recursive – endless – flows.
Note: You can also use this example to Convert HTML files created using PowerApps.
Subscribe to this blog for the latest updates about SharePoint Online, Microsoft Flow, Power Apps and document conversion and manipulation.