Skip to main content

Notifications

Power Automate - Building Flows
Answered

Power Automate Html Convert to PDF

Like (1) ShareShare
ReportReport
Posted on 3 Mar 2022 13:00:59 by 108

Hi Everyone, I am trying to create a pdf from html document.

Everything is fine with HTML but when I am converting the html to PDF I am not getting the pdf as expected.
there are unnecessary spaces in borders and there are double borders in some tables.

 

is there any instructions to create such html so that pdf will be good? Please Help

@RezaDorrani

@Pstork1 @tom_riha @ScottShearer @abm 

  • PatrickC Profile Picture
    PatrickC 6 on 19 Jun 2023 at 20:00:38
    Re: Power Automate Html Convert to PDF

    I use http://jsbin.com. It updates the output in near real time. Has saved me so much time from nothing having to save and run my flow everytime I change something. I do hope Dlegal lets us know their code.

  • notchrisball Profile Picture
    notchrisball 3 on 27 Apr 2023 at 19:28:54
    Re: Power Automate Html Convert to PDF

    Would you ever share this code or does anyone know a place where I can find HTML to copy paste and use for my solution? I've never touched html but I was able to create a basic table and just want to go a step further. 

  • Dlegal Profile Picture
    Dlegal 7 on 10 Apr 2023 at 04:18:02
    Re: Power Automate Html Convert to PDF

    Thanks for posting this. This is a very good baseline to work from to build more advanced layouts and I would recommend anyone looking to avoid a premium connector to start with what you have provided and go from there. I only wish I found your response sooner.  As a result of further discovery (or pain depending on one's perspective) I was able to build out the following form/report. You can put together something a bit more elegant but at the cost of some sanity. 😄

     

    Sample layoutSample layoutPage 2Page 2

  • McPowerPlatform Profile Picture
    McPowerPlatform 38 on 02 Mar 2023 at 13:16:21
    Power Automate Html Convert to PDF

    Depending of the Document you are going to format, the best experience I had was using DIV's, keep in mind that Power Automate supports inline CSS so let me add you some code with a table with sample data: you can add this in the flow as a compose step, let me know how this works for you

    <div id="table" STYLE="display: table;">
    <div style="display: table-caption; padding: 0.5em; border: 1px solid #000;">Table Head with DivsS</div>
    <div style="display: table-row; ">
    <div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data 1</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data2</div><div style="display: table-cell; padding: 0.5em; border: 1px solid;">Data3</div>
    </div>
    <div style="display: table-row; ">
    <div style="display: table-cell; padding: 0.5em; border: 1px solid; " >Data 4</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data5</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; " > Data6</div>
    </div>
    <div style="display: table-row; ">
    <div style="display: table-cell; padding: 0.5em; border: 1px solid; " >Data 7</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; " >Data 8</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data 9</div>
    </div>
    </div>

  • jbushawgerber98 Profile Picture
    jbushawgerber98 5 on 07 Dec 2022 at 08:07:11
    Re: Power Automate Html Convert to PDF

    Does anyone know how to fix the conversion of the html file to PDF from destroying my HTML table?

     

    The HTML file displays fine, but the resulting PDF has a mashed up HTML Table that is not readable.

     

    jbushawgerber98_0-1670400475360.jpeg

    jbushawgerber98_1-1670400492050.jpeg

     

     

  • jbushawgerber98 Profile Picture
    jbushawgerber98 5 on 07 Dec 2022 at 06:12:48
    Re: Power Automate Html Convert to PDF

    What are you using to convert the HTML to PDF? Adobe has an option but it's premium.

  • McPowerPlatform Profile Picture
    McPowerPlatform 38 on 03 May 2022 at 15:54:59
    Re: Power Automate Html Convert to PDF

    Depending of the Document you are going to format, the best experience I had was using DIV's, keep in mind that Power Automate supports inline CSS so let me add you some code with a table with sample data: you can add this in the flow as a compose step, let me know how this works for you

    <div id="table" STYLE="display: table;">
    <div style="display: table-caption; padding: 0.5em; border: 1px solid #000;">Table Head with DivsS</div>
    <div style="display: table-row; ">
    <div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data 1</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data2</div><div style="display: table-cell; padding: 0.5em; border: 1px solid;">Data3</div>
    </div>
    <div style="display: table-row; ">
    <div style="display: table-cell; padding: 0.5em; border: 1px solid; " >Data 4</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data5</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; " > Data6</div>
    </div>
    <div style="display: table-row; ">
    <div style="display: table-cell; padding: 0.5em; border: 1px solid; " >Data 7</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; " >Data 8</div><div style="display: table-cell; padding: 0.5em; border: 1px solid; ">Data 9</div>
    </div>
    </div>

  • Dhruv100322 Profile Picture
    Dhruv100322 23 on 27 Apr 2022 at 13:44:23
    Re: Power Automate Html Convert to PDF

    Hi @Pstork1 ,

     

    I am facing similar issue. Can you please help?

    https://powerusers.microsoft.com/t5/General-Power-Automate/Converting-from-HTML-to-PDF-returns-nothing/td-p/1554290

  • Verified answer
    Dipak_Shaw Profile Picture
    Dipak_Shaw 108 on 15 Mar 2022 at 05:14:22
    Re: Power Automate Html Convert to PDF

    The issue was that I was using multiple tables and appending them one by one but I found that using colspan property in td tag we can create multiple columns in different rows in a single table and single table won't cause any css issue.

    Thanks

  • Pstork1 Profile Picture
    Pstork1 64,290 on 04 Mar 2022 at 12:57:06
    Re: Power Automate Html Convert to PDF

    As I mentioned there is certain CSS that is not respected by the built-in PDF conversion.  In my case it was page breaks.  The only option then is to use one of the third party connectors to do the conversion. I've had good luck with Encodian.  They have a free license that can be used to explore the possibities.  I would try their connector and see if you get the results you want.  If you do you'll either need to use a third party converter or modify your table styling to supported CSS.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,238

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,290

Leaderboard
Loading complete