/
Scripted Reports API (SR API)

Scripted Reports API (SR API)

SR - set of utility methods and libraries that are available in the Actonic Report Builder.

You can access API descriptions here sr-api (actonic.io) or by exploring the iFrame containing the same data below.

pdfOptions

By default SR uses pdfmake library for export. You can configure PDF layout with specifying PDFmake configuration object (for example, page format, page margins, landscape/portrait mode, watermark, etc).

SR.pdfOptions(pdfmakeConfigurationObject)

Example:

SR.pdfOptions({ pageOrientation: 'landscape', pageMargins: [20, 15, 20, 15], }); // expected result: page orientation of pdf to be landscape // and margins [left, top, right, bottom] to be applied.

Documentation for pdfmake: https://pdfmake.github.io/docs/0.1/

pdfDoc

Replace default export PDF result with specifying “jsPDF” object for export. If set, this method replaces pdfmake export that’s used by default.

SR.pdfDoc(jsPDFDoc)

Example:

const doc = new jsPDF(); doc.text("Hello world!", 10, 10); SR.pdfDoc(doc); // expected result: export to pdf default function will be replaced with // a new formatted document.

Documentation for jsPDF: https://github.com/parallax/jsPDF

Read more about Scripted Reports, the Gallery and Exporting.

Related content