Convert HTML to PDF using Microsoft Flow

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.

Prerequisites:

Please make sure the following prerequisites are in place:

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:


Step 1:

  • 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.

Step 2: 

  • 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s