Exporting a Dashboard to PDF
Our sample projects and report templates can help you learn the basics of working with our products.A dashboard can be rendered and exported to a PDF file straight from code, then saved in the browser.
In React.
How it works. The export runs on the client engine and the result is saved as a file, so no server round-trip is needed.
In React.
import { Stimulsoft } from "stimulsoft-dashboards-js-react";
async function saveDashboardPdf() {
var report = new Stimulsoft.Report.StiReport();
report.loadFile("Dashboards/Dashboard.mrt");
await report.renderAsync2();
var pdfData = await report.exportDocumentAsync2(Stimulsoft.Report.StiExportFormat.Pdf);
Stimulsoft.System.StiObject.saveAs(pdfData, report.reportAlias + ".pdf", "application/pdf");
}
function App() {
return <button onClick={saveDashboardPdf}>Export to PDF</button>;
}renderAsync2()— build the dashboard document before exporting.exportDocumentAsync2(StiExportFormat.Pdf)→StiObject.saveAs(data, name, mime)— export to bytes and trigger the download.
How it works. The export runs on the client engine and the result is saved as a file, so no server round-trip is needed.