web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : ch5eBhFBHd8HaIEnf6muwX
Power Automate - General Discussion
Unanswered

HTML to PDF conversion broken

Like (2) ShareShare
ReportReport
Posted on 29 May 2024 06:13:30 by 14

So it seems within the last week or so, the HTML to PDF conversion method we use has broken. The page size is completely different and there seems to be several corrupted characters within the generated PDF. 

We use the OneDrive method of converting to get around using Encodian etc. This is sadly the way I have to do it to be within our licensing plan.

 

Has anyone else had this issue? Potentially found a fix or heard Microsoft mention anything about it?

I have the same question (0)
  • jbman88 Profile Picture
    10 on 04 Jun 2024 at 19:54:26
    Re: HTML to PDF conversion broken

    This is sort of a half-win, as is usually the case.

     

    Here is what Microsoft sent to me for things to check that ultimately led me to the fix:

    1. Open the HTML file in a web browser to ensure that the styling is correct.
    2. Check if there are any external CSS files linked to the HTML file. Make sure that the paths to these CSS files are correct and accessible.
    3. If the styling issue persists, consider using inline CSS styles instead of external CSS files. Inline styles are more likely to be preserved during the conversion process.
    4. Ensure that the HTML code is valid and well-formed. Any syntax errors or missing tags can cause issues during conversion.
    5. Remember to test the converted PDF file to verify that the styling is preserved as expected.

     

    Long story short, I had to rewrite the inline-styling portion of the code and our handy little PDF's are back to what they looked like prior to this.

    Short story long, when I wrote the HTML portion of the flow, I had to do so with the added variable of Power Automate's PDF conversion process. This process made some odd changes to the formatting when it converted the HTML to a PDF, so we had to counter those changes with additional styling to make it look good. I can only speculate here but I think they updated something on their end where it stopped auto-applying some of those (probably well-intentioned) styling/formatting oddities during the HTML - PDF conversion.

     

    To fix our formatting issues, I downloaded one of the flow-generated HTML files that are automatically stored in OneDrive, opened it in the browser, tweaked the code in the inspector, took a look at the print preview until it was closer to the original, applied the same changes to the flow in Power Automate where you generate the HTML, and, lastly, reran the flow. Rinsed and repeated until the PDF's were as close to their prior appearance as I could get. Most styling that needed adjusted were lower values for heightswidths, margins, along with some adjusted font sizes & the addition of an Arial font family.

     

    We have two flows being utilized that generate PDF's in this fashion and both were fixed by going through this process, so I certainly hope this helps you too!

  • cas001dk Profile Picture
    14 on 03 Jun 2024 at 11:56:37
    Re: HTML to PDF conversion broken

    Great! Thank you. Not always an easy process but I would definitely prefer a proper answer and solution from Microsoft compared to reworking several flows using this PDF conversion. 

  • jbman88 Profile Picture
    10 on 03 Jun 2024 at 11:38:04
    Re: HTML to PDF conversion broken

    They responded to my ticket saying they are "currently doing some research in regards your case" and asked a bunch of questions that I had already answered in the initial ticket, to further explain why it wasn't us. Flows hadn't been touched in over a year. That was Friday midmorning and we're into Monday so yep, going through the process. I'll certainly circle back when I hear more.

  • cas001dk Profile Picture
    14 on 03 Jun 2024 at 07:08:01
    Re: HTML to PDF conversion broken

    Did you or your team manage to contact Microsoft? If so, I'd love to be kept in the loop. Sadly we have to do sort of a workaround to get in contact here, and I'm still in the process of that. 

  • jbman88 Profile Picture
    10 on 31 May 2024 at 14:33:09
    Re: HTML to PDF conversion broken

    Yep, broke a handful of flows we had running too. Got complaints about awkward formatting and spacing. Stuck waiting on MS.

  • AlexEncodian Profile Picture
    4,409 Moderator on 29 May 2024 at 14:09:04
    Re: HTML to PDF conversion broken

    @cas001dk 

     

    There have been several posts about this on the forums so it seems to be a wider Microsoft issue. The only thing you can really do is raise a ticket with Microsoft.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 854 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 525 Moderator

#3
trice602 Profile Picture

trice602 318 Super User 2025 Season 2

Last 30 days Overall leaderboard