client-side-html-to-pdf
Mobile icon

Client-side HTML to PDF

Stable version 1.0.3 (Compatible with OutSystems 11)
Uploaded
 on 01 July 2022
 by 
4.0
 (2 ratings)
client-side-html-to-pdf

Client-side HTML to PDF

Documentation
1.0.3

Client-side HTML to PDF allows you to create a PDF client-side, on a mobile device (Reactive might work as well, but I have not tested this).

Actions

The module exposes the following actions:

PdfCreate

PdfCreate allows you to create a PDF file from screen content. It has the following input parameters:

  • ContainerId - the Id of the initial container to create the PDF from (other containers can be added later as additional pages, see PdfPageAdd and PdfPagesAdd below);
  • Title - the title of the PDF;
  • Subject - the subject of the PDF;
  • Author - the author of the PDF;
  • Keywords - the keywords of the PDF;
  • Creator - the creator of the PDF;
  • PaperSize - the paper (page) size of the PDF. See below for possible values. Default value: "a4".


It has a single output parameter:

  • PdfDescriptor - a descriptor to be used in subsequent PDF actions (it is input to all other actions).


PdfPageAdd

PdfPageAdd adds a page to a PDF in memory created with PdfCreate. It has the following input parameters:

  • PdfDescriptor - descriptor as returned by PdfCreate;
  • ContainerId - the Id of the container to create the additional page from.


PdfPagesAdd

PdfPagesAdd adds multiple pages to a PDF in memory create with PdfCreate, from a List widget. It has the following input parameters:

  • PdfDescriptor - descriptor as returned by PdfCreate;
  • ContainerName - the name (!) of the container inside a List Item widget.


PdfBinaryGet

PdfBinaryGet retrieves the PDF's binary, for subsequent handling (e.g. storing in the database, sending to an external service, downloading on the mobile device etc.). To actually download the PDF (browser only!), use PdfBinaryDownload. It has the following input parameter:

  • PdfDescriptor - descriptor as returned by PdfCreate.


It also has a single output parameter:

  • PdfBinary - binary content representing the PDF file.


PdfBinaryDownload

PdfBinaryDownload retrieves the PDF's binary and downloads it (as "example.com"). Note this action only works in the browser (so for testing), not on an actual mobile device (you'll need a plugin on a mobile device). 

It has the following input parameter:

  • PdfDescriptor - descriptor as returned by PdfCreate.


Paper sizes

The following paper size are supported:

Paper sizeWidth (pt)Height (pt)
a02383.943370.39
a11683.782383.94
a21190.551683.78
a3841.891190.55
a4595.28841.89
a5419.53595.28
a6297.64419.53
a7209.76297.64
a8147.40209.76
a9104.88147.40
a1073.70104.88
b02834.654008.19
b12004.092834.65
b21417.322004.09
b31000.631417.32
b4708.661000.63
b5498.90708.66
b6354.33498.90
b7249.45354.33
b8175.75249.45
b9124.72175.75
b1087.87124.72
c02599.373676.54
c11836.852599.37
c21298.271836.85
c3918.431298.27
c4649.13918.43
c5459.21649.13
c6323.15459.21
c7229.61323.15
c8161.57229.61
c9113.39161.57
c1079.37113.39
dl311.81623.62
letter612792
government-letter576756
legal6121008
junior-legal576360
ledger1224792
tabloid7921224
credit-card153243