This example shows how to export a report to the PDF format from code. You need to create the report object of the StiReport type, then load the report template file by calling the loadFile() method. After this, you should render the report by calling the renderAsync() method of the report object:
// Create a new report instance
var report = new Stimulsoft.Report.StiReport();
// Load report from url
report.loadFile("../reports/SimpleList.mrt");
// Render report
report.renderAsync(function () {
	document.getElementById("savePdf").disabled = false;
});

For exporting a report to the PDF format you can use the exportDocumentAsync() function of the StiReport object. As the first argument, you need to specify the callback function that will be called after the export is complete. The second argument indicates the export format. For example, the result is saved to the file using the StiObject.saveAs() method. This method was added in the Stimulsoft library, you can use it for saving files:
<button id="savePdf" onclick="saveReportPdf()" disabled>Save PDF report to file</button>
function saveReportPdf() {
	// Export to PDF
	report.exportDocumentAsync(function (pdfData) {
		// Get report file name
		var fileName = report.reportAlias;
		// Save data to file
		Stimulsoft.System.StiObject.saveAs(pdfData, fileName + ".pdf", "application/pdf");
	}, Stimulsoft.Report.StiExportFormat.Pdf);
}

На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

Export Report to PDF