Converting HTML to PDF - Inline-Block Elements Don't Work

Copper Contributor

Hello everyone!


I'm working on a flow that takes the response from an MS Form, imports the response into an HTML document, converts the HTML to a PDF, and finally emails the PDF to someone. The problem being that no matter how I try to format the HTML, there are certain portions of it that just don't seem to work - mostly the in-line elements don't appear in-line. Every solution I've attempted has them looking correct in the editor, but once I test out the Flow, they're no longer in-line. 


I've included my current Flow, and the HTML script (edited down to remove identifying information) that I've got at the moment.



<!DOCTYPE html>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Test Title</title>
<body style="text-align:center">
<img src="data&colon;image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAAAwCAIAAAByj2opAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAUfSURBVHhe7ZzrgeMgDIS3rhSUelKNm0kxe2BkIx4SAstcwur7tZvIYhjG2M7l9ufXML4fy7GxApZjYwUsx8YKWI6NFbAcGytgOTZWwHJsrIDl2FgBy7GxApZjYwUsx8YKWI6NFbAc38bbAz8bNyPJ8Xt7vZ4Pxw/C/fp8vjZbqRrvV/TqucGLd4EH6+d2eXNgc/zeXHxhvgwPn2c4xHAkyXq8bvZme8JIQ9wubw5Ujn2EYaYyHk/L8sE35Xjl/bhypXJ77mtzdxEH27b5ew14N7DIqa3BuQs43yaYAouSscVlfPg7wBrQ4L/j9s0oFV7rocxxHuLGRovuPSzHnwVayY9fGqR16AqR5zhNsXT64S7EcvxZ/N0cpyle5Nbpz/Jnc4yfGGxz/Xr+aI6TzfiWvdg/eqQPh/5T6NaH0OfZFW/U80aCLggtGW/XBV5zLZIHuviI1fgYB7QgMaAF3r/ChRz3WoR2QGaoQlASOQqR9pjje2OcrHkFRix6knU1zmCykXskhWMo9GRUVKDR47rSHRsfbaYnxghjOR6zCAWZGgxbBlbho2gkYYw5xj2VY1wumDu7k7N9hxgVBYjJMMAt2N0y0IHRTMGi0lxbh4EcX7AI56cyXCXFDjce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lj4lG9GSLpghwbxsdjOTZWwHJsrIDl2FgBy7GxApZj4/v5/f0HHJFjFOX1vWsAAAAASUVORK5CYII=" width="236.16px" height="48px" style="display:inline-block"/>
<table style="display:inline-block" align="right">
<td style="font-size:12px">For Office Use Only</td>
<tr style="border:0px">
<td style="font-size:12px">Fall Semester 20____</td>
<tr style="border:0px">
<td style="font-size:12px">Spring Semester 20____</td>


6 Replies

Hi @McTwitch,

What I'd try:

1/ remove


2/ or remove

<img src="data&colon;image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAAAwCAIAAAByj2opAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQ...

Does that make any difference?

Kind regards



Hello @hansleroy


Unfortunately, I can't remove those parts. The <img> tag is an image that I need in the final document, and I'm trying to get the <table> and the <img> to display in-line with eachother. 

Well, at least something has to be tweaked, no?
At least I'd remove the <table> tags to see if it makes any difference.
Kind regards
We're attempting something similar. In our case, generating a HTML file using DIVs to display and image and overlay text on the image. The HTML file is generated correctly, however when converting via the OneDrive step, the overlay text is "stacked up" at the bottom of the PDF. Using the browser print on the HTML file, the text is correctly placed in the PDF. Perhaps this is a bug/limitation of the Convert File step and why still in preview? Curious to know if anyone has successfully accomplished this.
Wait, so when you take the generated HTML and use the print to PDF function, the text displays correctly?

I honestly haven't tried that, but it does take away from the auto-generated portion of it. I know that I went through and created an HTML document by hand that had all of the correct formatting, and when I copied and pasted it into the Create a Document portion of my flow, a lot of the formatting didn't stick, so I've been working on recreating all of it in that box, to make sure what I have actually works. I'm just getting stuck on the getting the image and text to display in-line!

Any chance I could take a look at your flow, to see how you have it set up?

EDIT: updated HTML to include image variable.


@McTwitch - the flow is basic right now, just trying to get it to work.


The Get File Content, retrieves the image and the next step loads it into a variable.  In the Create File, we build the HTML string, along with the image variable, and save as HTML file to OneDrive.  At this point, the HTML displays correctly and we can do a print to PDF from the browser and the PDF matches the HTML.  The Convert File, we convert to PDF and then create the PDF in OneDrive, at which point, the text overlay is no longer displaying correctly.   It seems like the conversion in Power is breaking the format. Here's a sample of the HTML we're generating (sorry for inline, can't attach .txt to the post): 


<!DOCTYPE html>
<html><head><meta name="viewport" content="width=device-width, initial-scale=1">
.container {position: absolute; text-align: center;color: black;}
.bottom-left {position: absolute; bottom: 8px;left: 16px;}
.top-left {position: absolute;top: 8px;left: 16px;}
.top-right {position: absolute;top: 8px;right: 16px;}
.bottom-right {position: absolute;bottom: 8px;right: 16px;}
.centered {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);}
<h2>Image Text</h2>
<p>How to place text over an image:</p>
<div class="container">

<img src="',variables('PDFImage'),'" alt="Snow" style="width:100%;">

<div class="bottom-left">Bottom Left</div>
<div class="top-left">Top Left</div>
<div class="top-right">Top Right</div>
<div class="bottom-right">Bottom Right</div>
<div class="centered">Centered</div>


Hope this helps.