Collection of PDF functions.
Methods
create
create(htmlBody: string | string[], options?: {
format?: 'A4' | 'Letter' | 'Legal' | 'Ledger' | 'Tabloid' | 'A0' | 'A1' | 'A2' | 'A3' | 'A5' | 'A6',
landscape?: boolean,
margin?: { top?: number, right?: number, bottom?: number, left?: number },
/**
* Paper width, accepts values labeled with units.
*/
width?: string | number,
/**
* Paper height, accepts values labeled with units.
*/
height?: string | number,
/**
* HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:
* - date: formatted print date
* - title: document title
* - url: document location
* - pageNumber: current page number
* - totalPages: total pages in the document
*/
headerTemplate?: string,
/**
* HTML template for the print footer. Should use the same format as the headerTemplate.
*/
footerTemplate?: string,
/**
* Whether or not to embed the document outline into the PDF. Defaults to false.
*/
outline?: boolean,
/**
* Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
*/
pageRanges?: string,
/**
* Print background graphics. Defaults to false.
*/
printBackground?: boolean,
/**
* Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.
*/
scale?: number,
/**
* Whether or not to generate tagged (accessible) PDF. Defaults to false.
*/
tagged?: boolean,
httpHeaders?: Record<string, string>,
localStorage?: Record<string, string>,
sessionStorage?: Record<string, string>,
cookies?: Record<string, string>
})Creates a PDF document from given HTML. Returns a base64 encoded string.
Parameters
htmlBody string | string[]
The HTML to convert to PDF. Can be a single string or an array of strings for multiple pages.
options { format?: 'A4' | 'Letter' | 'Legal' | 'Ledger' | 'Tabloid' | 'A0' | 'A1' | 'A2' | 'A3' | 'A5' | 'A6', landscape?: boolean, margin?: { top?: number, right?: number, bottom?: number, left?: number }, /* * Paper width, accepts values labeled with units. / width?: string | number, /* * Paper height, accepts values labeled with units. / height?: string | number, /* * HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: * - date: formatted print date * - title: document title * - url: document location * - pageNumber: current page number * - totalPages: total pages in the document / headerTemplate?: string, /* * HTML template for the print footer. Should use the same format as the headerTemplate. / footerTemplate?: string, /* * Whether or not to embed the document outline into the PDF. Defaults to false. / outline?: boolean, /* * Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. / pageRanges?: string, /* * Print background graphics. Defaults to false. / printBackground?: boolean, /* * Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2. / scale?: number, /* * Whether or not to generate tagged (accessible) PDF. Defaults to false. / tagged?: boolean, httpHeaders?: Record<string, string>, localStorage?: Record<string, string>, sessionStorage?: Record<string, string>, cookies?: Record<string, string> }
(optional) The additional PDF options.
Return type
string
Examples
createFromUrl
Creates a PDF document from a given url. Returns a base64 encoded string.
Parameters
url string | string[]
The url to convert to PDF.
options { format?: 'A4' | 'Letter' | 'Legal' | 'Ledger' | 'Tabloid' | 'A0' | 'A1' | 'A2' | 'A3' | 'A5' | 'A6', landscape?: boolean, margin?: { top?: number, right?: number, bottom?: number, left?: number }, /* * Paper width, accepts values labeled with units. / width?: string | number, /* * Paper height, accepts values labeled with units. / height?: string | number, /* * HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: * - date: formatted print date * - title: document title * - url: document location * - pageNumber: current page number * - totalPages: total pages in the document / headerTemplate?: string, /* * HTML template for the print footer. Should use the same format as the headerTemplate. / footerTemplate?: string, /* * Whether or not to embed the document outline into the PDF. Defaults to false. / outline?: boolean, /* * Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. / pageRanges?: string, /* * Print background graphics. Defaults to false. / printBackground?: boolean, /* * Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2. / scale?: number, /* * Whether or not to generate tagged (accessible) PDF. Defaults to false. / tagged?: boolean, httpHeaders?: Record<string, string>, localStorage?: Record<string, string>, sessionStorage?: Record<string, string>, cookies?: Record<string, string> }
(optional) The additional PDF options.
Return type
string
Examples
renderForm
Render a Ruleset Form to PDF.
Parameters
formName string
The name or ID of the Form (e.g. "Form1").
context { [key: string]: any; }
The context to render the form with.
options { format?: 'A4' | 'Letter' | 'Legal' | 'Ledger' | 'Tabloid' | 'A0' | 'A1' | 'A2' | 'A3' | 'A5' | 'A6', landscape?: boolean, margin?: { top?: number, right?: number, bottom?: number, left?: number }, /* * Paper width, accepts values labeled with units. / width?: string | number, /* * Paper height, accepts values labeled with units. / height?: string | number, /* * HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: * - date: formatted print date * - title: document title * - url: document location * - pageNumber: current page number * - totalPages: total pages in the document / headerTemplate?: string, /* * HTML template for the print footer. Should use the same format as the headerTemplate. / footerTemplate?: string, /* * Whether or not to embed the document outline into the PDF. Defaults to false. / outline?: boolean, /* * Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. / pageRanges?: string, /* * Print background graphics. Defaults to false. / printBackground?: boolean, /* * Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2. / scale?: number, /* * Whether or not to generate tagged (accessible) PDF. Defaults to false. / tagged?: boolean, httpHeaders?: Record<string, string>, localStorage?: Record<string, string>, sessionStorage?: Record<string, string>, cookies?: Record<string, string> }
(optional) The additional PDF options.
Return type
string