Learn how to create a PDF file from HTML with Power Automate without any premium connectors.
Step by step: How to create PDF from HTML with Power automate
Learn how to create a PDF file from HTML step by step.
-
Create a flow with manual trigger
![Power Automate: Create A PDF File From HTML [No Premium] 4 power automate create instant flow](https://zeitgeistcode.com/wp-content/uploads/2021/12/powerautomate-create-instant-flow.png)
Create instant flow
-
Add a ‘Compose’ action
![Power Automate: Create A PDF File From HTML [No Premium] 5 Power Automate Add Compose Action](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Add-Compose-Action.png)
Add Compose Step
-
Copy the HTML into Compose
![Power Automate: Create A PDF File From HTML [No Premium] 6 Power Automate Copy HTML To Compose Inputs](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Copy-HTML-To-Compose-Inputs.png)
Paste HTML
-
Add a ‘Create file’ action
![Power Automate: Create A PDF File From HTML [No Premium] 7 Power Automate Create File Action](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Create-File-Action.png)
Create file
-
Set ‘Create file’ Folder Path, File Name and File Content
![Power Automate: Create A PDF File From HTML [No Premium] 8 Power Automate Create File Setup](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Create-File-Setup.png)
Create HTML File configuration
-
Add a ‘Convert file using path’ action
![Power Automate: Create A PDF File From HTML [No Premium] 9 Power Automate Convert File Using Path](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Convert-File-Using-Pathj.png)
Convert file using path
-
Configure ‘Convert file using path’ action’s File Path and set Target Type to PDF
![Power Automate: Create A PDF File From HTML [No Premium] 10 power automate pdf convert file](https://zeitgeistcode.com/wp-content/uploads/2022/03/power-automate-pdf-convert-file.png)
Convert file using path configuration
-
Add another ‘Create File’ action
![Power Automate: Create A PDF File From HTML [No Premium] 7 Power Automate Create File Action](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Create-File-Action.png)
Create file action
-
Set ‘Create file’ Folder Path, File Name and File Content
![Power Automate: Create A PDF File From HTML [No Premium] 12 power automate pdf file from html create pddf file](https://zeitgeistcode.com/wp-content/uploads/2022/03/power-automate-pdf-file-from-html-create-pddf-file.png)
Configuration of ‘Create file’
-
Add a ‘Send an email (V2)’ action
![Power Automate: Create A PDF File From HTML [No Premium] 13 Power Automate Send an Email Action](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Send-an-Email-Action.png)
Send an email (V2)
-
Finally send the PDF file via email
![Power Automate: Create A PDF File From HTML [No Premium] 14 Power Automate Send An Email Configuration](https://zeitgeistcode.com/wp-content/uploads/2022/03/Power-Automate-Send-An-Email-Configuration.png)
Configuration ‘Send an email (V2)’
HTML for Copy and Paste
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<style>
* {
font-family: Arial;
font-size: 11px;
}
th,td {
padding:6px;
text-align: start;
vertical-align: text-top;
}
th{
max-width: 100px;
min-width: 100px;
}
td{
max-width: 340px;
min-width: 340px;
}
h3{
font-size: 20px;
font-weight: bolder;
padding-bottom: 4px;
margin-bottom: 0px;
}
td{
background-color:#f3f3f3;
}
</style>
<h3>Sample PDF</h3>
<table>
<tr>
<th>First name </th>
<td>John</td>
<th>Last name</th>
<td>Doe</td>
</tr>
<tr>
<th>Age</th>
<td>27</td>
<th>Gender</th>
<td>Male</td>
</tr>
<tr>
<th>Country</th>
<td>USA</td>
<th>City</th>
<td>New York</td>
</tr>
</table>
</body>
</html>
![Power Automate: Create A PDF File From HTML [No Premium] 2 power automate Create A PDF File From HTML](https://zeitgeistcode.com/wp-content/uploads/2022/03/power-automate-Create-A-PDF-File-From-HTML.png)
Hi
I tried the above-mentioned steps, I am able to create the pdf as attachment into the received email but getting an error while opening that PDF as:
“Something went wrong
Unable to open the file”
Please guide me what is the possible solution for this.
Hard to say,maybe your HTML is incorrect?
You may paste it here to check https://validator.w3.org/#validate_by_input
I too was receiving that error and found a solution. In step 9 above, the `File Content` field shows to use the dynamic content `Body`. However, when I used that, it said it was Blob Meta Data. And when opening the pdf in VSCode it was just a JSON object of the meta data, not the actual file contents. So, I changed the `File Content field` to the dynamic data called `File Content` in step 9 and in the attachment of the email, and this corrected the error.
THANK YOU Steve for taking the time to pointing to the solution! I’ve adjusted the image.
same issue i have
Use File Content instead of Body.