How to convert HTML file to PDF using Power Automate
Power Automate have simplified our tasks to a great extent. Requirements which would take few months previously are now accomplished in few weeks and weeks development may be in days.
And here is one such requirement I will discuss. The requirement is very simple. Convert HTML document to PDF. Basically if you have the following requirements, you are on the right blog.
- Print a HTML web page to PDF
- Convert word/ excel or any other document to PDF format
- HTML Text to PDF document
So let’s see how we can accomplish the same. While unknown to many, Power Automate’s OneDrive for Business connector have such actions which easily can perform these operations. So let’s get started.
I create an Instant Power Automate flow with manual trigger. Basically it can be a scheduled/ automated/ instant – any type of flow.
As a next step I use a variable to hold my HTML text. The HTML is basically a simple table containing information about couple of contacts. Below is the screenshot of the sample HTML output and the flow as of now.


It really does not matter how complex your HTML is. The construct remains the same.
In the next step, I go ahead with the creating the file. I use the ‘OneDrive for Business Connector‘ and use the ‘Create File‘ action.

As you can see in the above screenshot, I am saving the HTML content to a HTML file in Documents folder in one drive.
Now comes the important step. I use the ‘Convert File’ action to convert the HTML file and get the PDF content out of it.

The action is still in preview as of the time of writing this blog. But I don’t find any reason why this will not make it to final release.
And the final step is take the PDF content and use the “Create File” action again to save the content as PDF file.

And that will be all. In the Documents folder in the OneDrive, I can now see both the PDF and the HTML content saved.

And below is the content of the PDF file when I open it. Cool, isn’t it?

A quite complex requirement for yesteryears development but certainly simple with Power platform.
posted on 2021-04-20 14:01 lingdanglfw 阅读(110) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?