Creating reports and dashboards | Stimulsoft community forum
Reporting tool and data analytics tools for creating reports and dashboards in ASP.NET, ASP.NET MVC, .NET Core, Blazor, Angular, PHP, Python, WPF, JavaScript, and Java applications.
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 13072 times
js_render_bug__Is.PNG (7.39 KiB) Viewed 13072 times