cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LukeB
Level: Powered On

Converting HTML to PDF Issue

I have created a Flow that takes input from a PowerApp, converts it to a HTML file in OneDrive and then converts it to a PDF file and saves it as an attachment in a SharePoint list. All steps work ok. 

 

The issue I am having is that if I have code after inserting a table in the HTML, if there is any code after the table, the table and everthing after does not appear. If there is nothing after the table it displays correctly. 

 

I have taken out the variables and put in static code to ensure that the issue is not to do with the code that is getting passed through to it from PowerApps.

 

Wondering if this is a bug?

 

For example the following code works:

<body>

<h1>Heading</h1>

<table>

<tr>

<td></td>

</tr>

</table>

</body>

 

This fails to display the table and everything below the table:

<body>

<h1>Heading</h1>

<table>

<tr>

<td></td>

</tr>

</table>

<h2>Heading 2</h2>

</body>

4 REPLIES 4
tfhegdbn
Level: Powered On

Re: Converting HTML to PDF Issue

Hi ,

Can you share the details of your Flow configuration?Perhaps your code breaks the level of the original Html tag. Make some of the content that should be displayed covered.

LukeB
Level: Powered On

Re: Converting HTML to PDF Issue

I have removed all steps so that there is only a trigger and a "One Drive - Create File" step. It is configured as:

Snippet.jpg

 

The code I have is:

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Document</title>
</head>

<body>
    <span>
        <h1>Report</h1>
        <p>
            Test Report
        </p>
        <table width=100%>
            <tr>
                <td>
                    <strong>Title 1</strong>
                </td>
                <td>
                    Some Text
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Title 2</strong>
                </td>
                <td>
                    Some more text
                </td>
            </tr>
         </table>
      <h1>Another Heading</h1>
    </span>
</body>
</html>

With the line in red, when you open the file in One Drive you get:

WithHeading.jpg

When you take the line out you get:

WithoutHeading.jpg

The files display as expected when you download from One Drive and open in a browser. If you convert to PDF however the PDF looks like how the file displays when opened in One Drive, not the browser.

 

To meet my requirements I need to have multiple tables, headings and paragraphs. I can get away with sending as an email from PowerApps (which works fine) and not convert to PDF if this does not work but...

JackDog
Level: Powered On

Re: Converting HTML to PDF Issue

Try removing the span tags.

VitorPereira
Level: Powered On

Re: Converting HTML to PDF Issue

Did you ever get a workaround for this?

 


@LukeB wrote:

I have removed all steps so that there is only a trigger and a "One Drive - Create File" step. It is configured as:

Snippet.jpg

 

The code I have is:

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Document</title>
</head>

<body>
    <span>
        <h1>Report</h1>
        <p>
            Test Report
        </p>
        <table width=100%>
            <tr>
                <td>
                    <strong>Title 1</strong>
                </td>
                <td>
                    Some Text
                </td>
            </tr>
            <tr>
                <td>
                    <strong>Title 2</strong>
                </td>
                <td>
                    Some more text
                </td>
            </tr>
         </table>
      <h1>Another Heading</h1>
    </span>
</body>
</html>

With the line in red, when you open the file in One Drive you get:

WithHeading.jpg

When you take the line out you get:

WithoutHeading.jpg

The files display as expected when you download from One Drive and open in a browser. If you convert to PDF however the PDF looks like how the file displays when opened in One Drive, not the browser.

 

To meet my requirements I need to have multiple tables, headings and paragraphs. I can get away with sending as an email from PowerApps (which works fine) and not convert to PDF if this does not work but...


 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 264 members 4,598 guests
Please welcome our newest community members: