Rendering a Report from Code
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.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.
How it works. PHP only generates the engine code; the actual rendering — and the resulting document — lives entirely in the browser.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

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();
}$report->render()— emits the JavaScript that builds the report on the client; nothing is rendered server-side.onAfterRender— client callback with the finishedargs.report, ready to inspect or serialize withsaveDocumentToJsonString().
How it works. PHP only generates the engine code; the actual rendering — and the resulting document — lives entirely in the browser.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
