Rendering a Report from Code on the Server-Side
Our sample projects and report templates can help you learn the basics of working with our products.Reports.Python can render reports fully on the server using an embedded Node.js engine, with no browser involved.
Code overview. Initialize the required report objects, render a report from code on the server-side, and handle the resulting state or output.
Code overview. Initialize the required report objects, render a report from code on the server-side, and handle the resulting state or output.
report = StiReport()
report.engine = StiEngineType.SERVER_NODE_JS
if report.processRequest(request):
return report.getFrameworkResponse()
report.loadFile(url_for('static', filename='reports/SimpleList.mrt'), True)
result = report.render()
if result:
document = report.saveDocument()
message = f'The finished document takes {len(document)} bytes.'
else:
message = report.nodejs.errorSetting engine = StiEngineType.SERVER_NODE_JS runs the rendering in Node.js on the server; saveDocument() returns the rendered document. This is the basis for scheduled or headless report generation without a client.