In this Power Automate tutorial, we will see how to convert HTML to pdf in Power Automate.
To convert HTML to PDF, we can use one of the below methods in Power Automate.
- Using Convert HTML to Pdf-Encodian
- Using Convert file – One Drive business
Power Automate Convert HTML to Pdf (Using Convert HTML to PDF- encodian)
Here we will see how to convert HTML to Pdf using Power Automate.
For example, we have the below HTML code, and we will convert it to a Pdf file and then create a file in the SharePoint Library.
To use the Encodian action, we need the Api key, for this fill and submit the form, it will generate an Api key for you. Later while using the Encodian action you can configure it with the API key.
Now, let’s see how to convert Html to Pdf using Convert Html to PDF action from Encodian in Power Automate.
Step 1: Log in to Power Automate and click +Create -> select Instant Cloud flow.
Then provide the flow name, and select the Manually trigger a flow action. Then click on Create.
Now, you can see the Manually trigger a flow action is added to the flow page.
Step 2: Next, we will add HTML content that we will convert to pdf. So, click on Add an action -> select Compose action. Then provide the below information:
- Inputs: Provide the inputs like below.
<!DOCTYPE html>
<html>
<head>
<title>HTML to PDF Example</title>
</head>
<body>
<h1>HTML to PDF Example</h1>
<p>This is a sample HTML file to test the conversion to PDF using Power Automate.</p>
<ul>
<li>Create Html file</li>
<li>Convert HTml file to pdf</li>
<li>Send an email with pdf file</li>
</ul>
</body>
</html>
Step 3: Now we will convert HTML to pdf, so click on the +New step action -> then click on Convert HTML to PDF action from Encodian. Then provide the below information:
- PDF file name: Provide the pdf file name.
- HTML Data: Provide the output of compose action from dynamic content.
Step 4: Next we will create a pdf file in the SharePoint folder. So, click on the +New step -> select Create File action. Then provide the below information:
- Site address: Select or provide a SharePoint site address.
- Folder path: Select the folder path
- File name: Select or provide the file name from dynamic content.
- File content: Select or provide the file content from dynamic content
Step 5: Now run the flow, click on the test icon, then select manually -> click on the test button.
You can see your flow run successfully, and a new pdf file is created in the SharePoint Library.
This is an example of converting HTML to pdf using Power Automate Encodian.
Convert HTML to Pdf in Power Automate (Using Convert File- One drive)
Here we will see how to convert HTML to Pdf using the Convert file action from One Drive for business in Power Automate.
For example, we will create an instant cloud flow that will take HTml code and then create an HTML file. Then we will convert the file to a pdf file and create a file in the SharePoint library.
Now let’s create the flow that will convert the Html to pdf using Power Automate.
Step 1: Log in to Power Automate and click the +Create icon -> select Instant Cloud flow.
Then provide the flow name, and select the Manually trigger a flow action. Then click on Create.
Now, you can see the Manually trigger a flow action is added to the flow page.
Step 2: Next, we will add HTML content that will convert to pdf. So, click on Add an action -> select Compose action. Then provide the below information:
- Inputs: Provide the inputs like below.
<!DOCTYPE html>
<html>
<head>
<title>HTML to PDF Example</title>
</head>
<body>
<h1>HTML to PDF Example</h1>
<p>This is a sample HTML file to test the conversion to PDF using Power Automate.</p>
<ul>
<li>Create Html file</li>
<li>Convert HTml file to pdf</li>
<li>Send an email with pdf file</li>
</ul>
</body>
</html>
Step 3: Now we will create an Html file using the above content, so click on the +New step -> select Create file action -One Drive. Then provide the below information:
- Folder path: Select the folder path where file will create.
- File name: Provide the file name.
- File content: Provide the output from dynamic content.
Step 4: Now we will convert the HTML to pdf file, so click on the +New step -> select Convert file action. Then provide the below information:
- File: Select the Id from dynamic content.
- Type: Select the type as pdf.
Step 5: Finally, we will create a Pfd file in the Sharepoint library. So, click on the +New step -> Select Create file action – SharePoint. Then provide the below information:
- Site address: Select or provide a SharePoint site address.
- Folder path: Select the folder path
- File name: Select or provide the file name from dynamic content.
- File content: Select or provide the file content from dynamic content
Step 6: Now run the flow, click on the Test icon, then select manually -> click on the Test button.
You can see your flow run successfully, and a new pdf file is created in the SharePoint Library.
This is an example of converting Html to pdf using Power Automate.
Conclusion
In this Power Automate tutorial, we will see how to convert HTML to Pdf file in Power Automate. Here we saw 2 different ways to convert it, these are:
- Using Convert HTML to Pdf-Encodian
- Using Convert file – One Drive business
You may like the following Power Automate tutorials:
- Create an array from JSON objects using Power Automate
- How to attach files to planner tasks using Power Automate?
- Create an Excel file from SharePoint list items using Power Automate.
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
Hi there, this tutorial worked perfectly. How would you now attach that same pdf to an email?