cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ThenewThom
Frequent Visitor

Converting HTML to PDF - some content not converting

Hello - the html text shown below in red is making it through a power automate process to the html stage OK but the conversion to pdf (One drive for Business - convert to pdf) doesn't seem to be picking it up. I have attached the two outputs (html and pdf) to show the missing content. Any advice gratefully received. Cheers. Thom

 


// This is HTML that sends to flow to generate the PDF file.
"<html>" & "<head>
<H1>ME Detail report: " & ddPlanName_1.Selected.Result & " - " & ddDate.Selected.Value & "</H1>
<p>" & HtmlExecutiveSumm.HtmlText & " </p><br>
<p>" & HtmlKPIDecline.HtmlText & " </p><br>
<p>" & HtmlSocCult.HtmlText & " </p>
<style>
a { color: blue; }
body { text-align: centre; }
h1 { color: green; }
table.one { border-collapse: collapse; border-spacing: 10px; }
table.two { border-collapse: collapse; border-spacing: 10px; }
table, td, th { border: 1px solid; border-color: lightgray; vertical-align: text-top}
td.content{ padding-left: 5px; padding-right: 5px; }
span { color: white; padding-top: 2px; padding-bottom: 2px; padding-left: 8px; padding-right: 8px; font-size: 80%; }
</style>
</head>" & "<body>" &
// Strategies - First Table etc

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ThenewThom ,

So this is now solved?

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @ThenewThom ,

The OneDrive PDF converter is not a "full blown" HTML resolver and things like CSS Styles often do not translate. I keep my HTML on these to fairly simple basic tags (table structure and colours, font bold, italic, underline etc) which generally do the job I need.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi Warren - thanks for responding. That's the part that's difficult to follow - the style applying to the tables works perfectly. It's the basic stuff (the <p> tags) that isn't going through. Cheers, Thom

Hi @ThenewThom ,

The other thing I forgot to mention is that the OneDrive converter is far less forgiving on structure inconsistencies such as the lack of closing tags. I have tested code that resolves perfectly in a Power Apps HTML control, but if the tags are not strictly correct gets unexpected results in the PDF like yours.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Thanks Warren - it was a problem with the label I used - the conversion handled .text with the html as a resolved output (rich text style) but I was feeding it html that included the filtering codes etc. Oh well, is working now

Hi @ThenewThom ,

So this is now solved?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,595)