const LoadReportFromString = (data) => {
console.log(data);
let report = new Stimulsoft.Report.StiReport();
report.load(data);
report.render();
return report;
};
const SaveReportAsPdf = (report) => {
console.log("Save Report: " + report.reportName);
//console.log(report);
// Create an PDF settings instance. You can change export settings.
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.exportTo(report, stream, settings);
// Get PDF data from MemoryStream object
var data = stream.toArray();
// Get report file name
var fileName = String.isNullOrEmpty(report.reportAlias) ? report.reportName : report.reportAlias;
// Save data to file
Object.saveAs(Buffer.from(data), fileName + ".pdf", "application/pdf");
};
I create the test.mrt file with the Stimulsoft C# Designer.
Now I tried to create a .pdf from this file, but from js code.
In the First picture you can see how it should be, in the second you see the result as it is.
For a test I also created a mrt with the JS Designer. With this mrt it was possible to save it as html.
But it also failed to save it as pdf.
I have add the .mrt file as attachment for you, too.
Attachments
js_render_bug__shouldBe.PNG (24.22 KiB) Viewed 12628 times
js_render_bug__Is.PNG (7.39 KiB) Viewed 12628 times