zoukankan      html  css  js  c++  java
  • 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.

    HTML to PDF in Power Automate, Word to PDF in Power AutomateHTML to PDF in Power Automate, Word to PDF in Power Automate

    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.

    HTML to PDF in Power Automate, Word to PDF in Power Automate

    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. 

    HTML to PDF in Power Automate, Word to PDF in Power Automate

    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.

    HTML to PDF in Power Automate, Word to PDF in Power Automate

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

    HTML to PDF in Power Automate, Word to PDF in Power Automate

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

    HTML to PDF in Power Automate, Word to PDF in Power Automate

    A quite complex requirement for yesteryears development but certainly simple with Power platform.

  • 相关阅读:
    昂达 v891 连接上adb 调试
    在不进入Guest OS的情况下,取得Guest OS的IP地址
    在远程连接一个 Wndows 10的情况下,重启远程机器
    放弃 Tightvnc, 选择 Tigervnc
    Ubuntu 16.04 构建 Headless VNC 服务器
    网站日志流量分析系统之数据可视化展示
    网站日志流量分析系统之离线分析(自动化脚本)
    网站日志流量分析系统之数据清洗处理(离线分析)
    网站日志流量分析系统之(日志收集)
    网站日志流量分析系统之(日志埋点)
  • 原文地址:https://www.cnblogs.com/lingdanglfw/p/14680772.html
Copyright © 2011-2022 走看看