A report is configured and loaded in PHP, but rendered by the JavaScript engine on the client — a callback fires when the build finishes.

Configure and load in PHP.
$report = new StiReport();
$report->javascript->relativePath = '../';
$report->onAfterRender = 'onAfterRender';
$report->process();

$report->loadFile('../reports/SimpleList.mrt');
$report->render();
Handle the result in JavaScript.
function onAfterRender(args) {
    // args.report is the rendered document
    let pages = args.report.renderedPages.count;
    let json = args.report.saveDocumentToJsonString();
}

How it works. PHP only generates the engine code; the actual rendering — and the resulting document — lives entirely in the browser.
In the screenshot below you can see the result of the sample code:

Rendering a Report from Code

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.