Hi
Why this code don't work?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Stimulsoft Reports.PHP - JS Report Viewer</title>
<!-- Stimusloft Reports.JS -->
<script src="scripts/stimulsoft.reports.js" type="text/javascript"></script>
<script type="text/javascript">
var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/SimpleList.mrt");
report.render();
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
var service = new Stimulsoft.Report.Export.StiPdfExportService();
var stream = new Stimulsoft.System.IO.MemoryStream();
service.exportTo(report, stream, settings);
var data = stream.toArray();
Object.saveAs(data, "SimpleList.pdf", "application/pdf");
</script>
</head>
<body>
</body>
</html>
Error in export to pdf
Re: Error in export to pdf
Hello,
Could you explain your issue in more details?
Also, please check the following code:
Thank you.
Could you explain your issue in more details?
Also, please check the following code:
Code: Select all
var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/test.mrt");
report.render();
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
// Create an PDF service instance.
var service = new Stimulsoft.Report.Export.StiPdfExportService();
// Create a MemoryStream object.
var stream = new Stimulsoft.System.IO.MemoryStream();
// Export PDF using MemoryStream.
service.exportToAsync(function () {
var data = stream.toArray();
// Get report file name
var fileName = String.isNullOrEmpty(report.reportAlias) ? report.reportName : report.reportAlias;
// Save data to file
Object.saveAs(data, fileName + ".pdf", "application/pdf");
}, report, stream, settings);