How to Convert HTML to PDF in Power Automate?

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.

power automate html to pdf

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.

How to convert html to pdf file using Microsoft power automate

Then provide the flow name, and select the Manually trigger a flow action. Then click on Create.

How to convert html to pdf using power automate

Now, you can see the Manually trigger a flow action is added to the flow page.

Microsoft power automate convert html to pdf

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>
Microsoft power automate html to pdf

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.
Using Microsoft power automate convert html to pdf file

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
Using power automate convert html to pdf file

Step 5: Now run the flow, click on the test icon, then select manually -> click on the test button.

See also  How to create a word document from a template in Power Automate

You can see your flow run successfully, and a new pdf file is created in the SharePoint Library.

How to convert html to pdf file using power automate

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.

power automate html to pdf

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.

How to convert html to pdf file using Microsoft power automate

Then provide the flow name, and select the Manually trigger a flow action. Then click on Create.

How to convert html to pdf using power automate

Now, you can see the Manually trigger a flow action is added to the flow page.

power automate convert html to pdf

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>
Microsoft power automate html to pdf

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.
Using Microsoft power automate convert html to pdf

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.
Using power automate convert html to 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
power automate convert html to pdf

Step 6: Now run the flow, click on the Test icon, then select manually -> click on the Test button.

See also  Power Apps Data Table [Complete Guide]

You can see your flow run successfully, and a new pdf file is created in the SharePoint Library.

power automate convert html to pdf file

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:

  • >