Convert HTML to PDF


The 'Convert HTML to PDF' flow action converts either HTML files (.html), HTML data or HTML data retrieved from a URL to a PDF document. 

Example Flow

Please refer to the following article showcasing the 'Convert HTML to PDF' flow action: Convert SharePoint List Items to PDF

Default Parameters

The default 'Convert HTML to PDF' flow action parameters are detailed below:

  • Filename: The filename to assign to the resulting PDF document (including the file extension).
  • File Content: (Optional) A Base64 encoded representation of the HTML (.html) file to be processed.
  • HTML Data: (Optional) Enter the HTML data to convert to a PDF document. 
  • HTML URL: (Optional) The web address to the web page which will be converted to a PDF document.
  • Page Orientation: Set the orientation of the pages within the resultant PDF document.
  • Page Size: Set the page size of the pages within the resultant PDF document

Either 'HTML Data' or 'HTML URL' or 'Filename' and 'File Content' parameters are required to create a PDF document. 

Please refer to the Obtaining the 'File Contents' Parameter article for guidance on how to obtain the 'File Content' parameter ready to provide to an Encodian flow action. 

Page Sizes

The 'Page Size' parameter allows you to choose from the following predefined page sizes.

  • A3 - 297 x 420 mm
  • A4 - 210 x 297 mm
  • A5 - 148 X 210 mm
  • B4 - 250 x 353 mm
  • B5 - 176 x 250 mm
  • Envelope DL - 110 x 220 mm
  • Executive - 7.25 x 10.5 inches
  • Folio - 8 x 13 inches
  • Ledger - 11 x 17 inches
  • Legal - 8.5 x 14 inches
  • Letter - 8.5 x 11 inches
  • Quarto - 8 x 10 inches
  • Statement - 8.5 x 5.5 inches
  • Tabloid - 11 x 17 inches

Additional Guidance

  • Encoding: To ensure the correct rendering of all characters contained within the HTML document, please add a <meta> charset attribute to the <head> tag to explicitly set the character encoding of the document prior to conversion to PDF. Further guidance can be found here
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  • The 'HTML Url' must be anonymously accessible; sites which require authentication are not currently supported.

Advanced Parameters

The advanced 'Convert HTML to PDF' flow action parameters are detailed below:

  • ViewPort: Set the viewport used to render the HTML.
  • Top Margin: Set the top margin value (pixels) The default value is set to 25.
  • Bottom Margin: Set the bottom margin value (pixels) The default value is set to 25.
  • Right Margin: Set the right margin value (pixels) The default value is set to 25.
  • Left Margin: Set the left margin value (pixels) The default value is set to 25.
  • Enable Bookmarks: Enable or disable auto-creation of PDF bookmarks.
  • Enable Javascript: Enable or disable javascript.
  • Enable Hyperlinks: Enable or disable hyperlinks.
  • Create PDF Form: Set whether the HTML content should be converted to a PDF form.
  • Decode HTML Data: Sets whether the HTML provided should be decoded prior to conversion. 
  • CSS Type: Set whether the standard or print style sheets should be used for HTML conversion.
  • Repeat Table Header: Set whether to repeat the table header on every page break.
  • Repeat Table Footer: Set whether to repeat the table footer on every page break.
  • Split Images: Set whether to split images.
  • Split Text Lines: Set whether to split text lines.
  • Delay: Set the delay in milliseconds between the HTML being received and the conversion to allow time for JavaScript to load.
  • Return File: (Advanced) Sets whether the action should return a file or alternatively an operation ID: Flow Action Return Options: File Content vs. Operation ID

Decoding HTML Data

The 'Decode HTML Data' parameter allows you to control whether the HTML provided either via a URL, a file or direct HTML should be decoded before creating the PDF document. 

HTML encoding is used to convert form data and other client request data from potentially unsafe characters to their HTML-encoded equivalent.

Encoded HTML Example

&#x3C;div style=&#x22;padding: 20px 20px 20px 20px;&#x22;&#x3E;
&#x3C;div style=&#x22;float:left; width:50%; font-family:Helvetica Neue,Helvetica,Arial,sans-serif;&#x22;&#x3E;
&#x3C;p style=&#x22;margin: 5px; font-size: 10px&#x22;&#x3E;Encodian&#x3C;/p&#x3E;
&#x3C;p style=&#x22;margin: 5px;font-size: 10px&#x22;&#x3E;Blythe Valley IC, Central Boulevard, Blythe Valley Business Park, Solihull, B90 8AJ&#x3C;/p&#x3E;
&#x3C;p style=&#x22;margin: 5px; padding-bottom: 3px; font-size: 8px&#x22;&#x3E;&#x3C;a href=&#x22;; target=&#x22;_blank&#x22; style=&#x22;color:#9F0DA3;&#x22;&#x3E;;/a&#x3E;&#x3C;/p&#x3E;
&#x3C;p style=&#x22;margin: 5px; font-size: 8px; color:#999;&#x22;&#x3E;Commercial in Confidence&#x3C;/p&#x3E;
&#x3C;p style=&#x22;margin: 5px; font-size: 8px; color:#999;&#x22;&#x3E;Encodian Solutions Ltd is registered in England and Wales No 10200243&#x3C;/p&#x3E;
&#x3C;div style=&#x22;float:left; width:50%;&#x22;&#x3E;
&#x3C;img style=&#x22;float:right; max-width:100px; height:auto;&#x22; src=&#x22;; /&#x3E;

Decoded HTML Example

<div style="padding: 20px 20px 20px 20px;">
<div style="float:left; width:50%; font-family:Helvetica Neue,Helvetica,Arial,sans-serif;">
<p style="margin: 5px; font-size: 10px">Encodian</p>
<p style="margin: 5px;font-size: 10px">Blythe Valley IC, Central Boulevard, Blythe Valley Business Park, Solihull, B90 8AJ</p>
<p style="margin: 5px; padding-bottom: 3px; font-size: 8px"><a href="" target="_blank" style="color:#9F0DA3;"></a></p>
<p style="margin: 5px; font-size: 8px; color:#999;">Commercial in Confidence</p>
<p style="margin: 5px; font-size: 8px; color:#999;">Encodian Solutions Ltd is registered in England and Wales No 10200243</p>
<div style="float:left; width:50%;">
<img style="float:right; max-width:100px; height:auto;" src="" />
Have more questions? Submit a request


  • 0
    Deron Dilger

    If you place dynamic content into the HTML Data property (as described in this article), you can copy that full HTML with those logicApp functions as text and save that in a file (e.g. MyTemplate.HTML).


    My question is, is there anyway to load that file (e.g. prior action loading it into a fileContents dynamicContent variable) and have it not only used by the HTML to PDF Action, BUT ALSO have the embedded logicApp functions get evaluated just as they would when using the method described in this article?

    I.e. it would be great to be able to avoid pouring the full HTML into the HTML Data to get dynamic content evaluated.  It sure makes the action LONG to scroll. :-)

Please sign in to leave a comment.
Powered by Zendesk