Exporting a Dashboard from Code on the Server-Side
Our sample projects and report templates can help you learn the basics of working with our products.With the Node.js engine, a dashboard can be rendered and exported entirely on the server — no browser involved. The result comes back as byte data.
Render and export via the Node.js engine.
How it works. Node.js runs the engine server-side, so the export completes without a client, ideal for scheduled or headless generation.
Render and export via the Node.js engine.
report = StiReport()
report.engine = StiEngineType.SERVER_NODE_JS
report.loadFile(current_app.static_folder + '/reports/WebsiteAnalytics.mrt')
result = report.render()
if result:
buffer = report.exportDocument(StiExportFormat.HTML)
# or save to a file:
# report.exportDocument(StiExportFormat.PDF, filePath)
else:
message = report.nodejs.errorreport.engine = StiEngineType.SERVER_NODE_JS— render on the server with Node.js instead of the browser.report.exportDocument(format)— returns the document bytes; pass a path to save it to a file instead.
How it works. Node.js runs the engine server-side, so the export completes without a client, ideal for scheduled or headless generation.