GeneratePDF (open)
Generate a PDF from a witty record
Syntax
LOADLIB "mod::system/lib/printer.whlib";
RECORD FUNCTION GeneratePDF(RECORD data, RECORD options)Parameters
RECORD dataWitty data
RECORD optionsOptions
BOOLEAN debugEnable debug mode
INTEGER delayHow much milliseconds to wait after setting the url before taking a screenshot
BOOLEAN displayheaderfooterDisplay header and footer. Defaults to FALSE
filenameOutput filename, will be genrated from the wittypath if not set
STRING footertemplateHeader template HTML code
getsourceGet a full dump of the data that will be used for the PDF. Used for debugging, may be removed in the future
STRING headertemplateHeader template HTML code
RECORD marginPage marginn (eg [ top := "0.5cm", bottom := "0.5cm", left := "1cm", right := "1cm" ]). Defaults to no margins
STRING mediaMedia to use - 'screen' or 'print' (default)
pdfenginePDF Engine to use. 'chrome' (default)
printbackgroundPrint backgrounds too? (defaults to true)
INTEGER timeoutTimeout (in milliseconds) for PDF generation. Defaults to 30 seconds
wittypathPath to witty template to use. If not set but the data contains a 'wittypath' variable, that one is used instead
Return value
RECORDWrapped file containing the PDF
Description
Header and footer templates can use <span class="pageNumber"></span> and <span class="totalPages"></span> to show the page number and total number of pages respectively, but due to a Chrome limitation
these are only shown if you also set the page margins to not intersect with these elements