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 Angular.
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 Angular.
@Component({
template: `<button (click)="saveDashboardPdf()">Export to PDF</button>`
})
export class Example {
async 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");
}
}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.