Client-side HTML to PDF

Stable Version 1.0.2 (Compatible with OutSystems 11)
Published on 31 March 2020 by 
4.0
 (1 rating)

Client-side HTML to PDF

Details
Generates a PDF client-side from HTML.
Read More

This module contains actions for creating a PDF client-side on a mobile device, even when off-line, based on screen content. It uses the jsPDF library to create the PDF file, but the parsing of the HTML was created by the author.

Note that the parsing is fairly rudimentary: from the specified container (div), the DOM is traversed and child <div>s, <img>s (PNG and JPG only), <br>s and text is processed and output to the PDF, taking into account foreground and background colours and borders (if present). HTML tables are not supported, so layout your page with containers (divs). Font support is also flaky, only standard PDF fonts are supported.

Since the DOM does not provide information on text wrapping, the script guestimates it, which sometimes results into wrong wrapping and/or container overflow. In these cases, it's best to experiment with slightly larger padding or margin. Also, always put text in its own container (as opposed to putting other elements in the same container as well), as positioning goes wrong in this case (not much I can do about that).

Elements with class "NoPdf" will be skipped—they won't be included in the PDF, nor will they be traversed (so child elements will also not appear in the output). A single element (typically a div) on the page can have class "PdfFooter". This element will then be positioned on the bottom of the page, even if not displayed as such on the screen.

What’s new (1.0.2)

Bugfix:

  • Elements (like an INPUT) that do not have a border-color set no longer break the code (in general, rgba() as color is now handled).


Updates:

  • Uses latest version of OutSystems UI (2.3.5)
Reviews (1)
2019-09-20
in version 1.0.1
Good to see this component is ready for the Forge now!