PDF export in Node with a report accessing databases
-
- Posts: 2
- Joined: Wed May 10, 2017 3:48 pm
PDF export in Node with a report accessing databases
Has anyone experimented exporting to PDF in Node with a report that access databases?
The example that Stimultsoft gives, is a report that loads information from a JSON file, but I can't do the same with a report that access databases.
By the way, How can we access in node, attributes like report.dictionary.databases.list or report.dataSources.items? Because I use them to build database connection and sql string, but it seems that node module (stimulsoft-reports-js) doesn't create report object with that attributes.
Thank you.
The example that Stimultsoft gives, is a report that loads information from a JSON file, but I can't do the same with a report that access databases.
By the way, How can we access in node, attributes like report.dictionary.databases.list or report.dataSources.items? Because I use them to build database connection and sql string, but it seems that node module (stimulsoft-reports-js) doesn't create report object with that attributes.
Thank you.
Re: PDF export in Node with a report accessing databases
Hello,
Please see the following link:
https://www.stimulsoft.com/en/documenta ... tabase.htm
Also, please check the following sample:
https://github.com/stimulsoft/Samples-J ... p%20Server
Thank you.
Please see the following link:
https://www.stimulsoft.com/en/documenta ... tabase.htm
Also, please check the following sample:
https://github.com/stimulsoft/Samples-J ... p%20Server
Thank you.
-
- Posts: 2
- Joined: Wed May 10, 2017 3:48 pm
Re: PDF export in Node with a report accessing databases
Hi Aleksey, thank you for your replay.
In Node there isn't StiOptions.WebServer.url option. I'm talking about a project rendered inside Node not HTML, as the example in https://github.com/stimulsoft/Samples-J ... 20PDF-file but not loading JSON, accessing a database instead.
Thank you.
In Node there isn't StiOptions.WebServer.url option. I'm talking about a project rendered inside Node not HTML, as the example in https://github.com/stimulsoft/Samples-J ... 20PDF-file but not loading JSON, accessing a database instead.
Thank you.
Re: PDF export in Node with a report accessing databases
Hello,
Yes, please check the following sample which shows how to connect to the database:
https://github.com/stimulsoft/Samples-J ... p%20Server
Thank you.
Yes, please check the following sample which shows how to connect to the database:
https://github.com/stimulsoft/Samples-J ... p%20Server
Thank you.
Re: PDF export in Node with a report accessing databases
Hello,
I've the same issue. I'm trying to generate a pdf in node calling it from a .net core application but the resulting pdf are empty. Here the code
https://gist.github.com/roadrunner75/f3 ... 434afead43
Thanks in advance
Andrea
I've the same issue. I'm trying to generate a pdf in node calling it from a .net core application but the resulting pdf are empty. Here the code
https://gist.github.com/roadrunner75/f3 ... 434afead43
Thanks in advance
Andrea
Re: PDF export in Node with a report accessing databases
I found the way
report.dictionary.databases.clear();
report.dictionary.databases.add(new Stimulsoft.Report.Dictionary.StiPostgreSQLDatabase("BloxSQL", "BloxSQL", connectionString));
report.dictionary.synchronize();
report.renderAsync(function () {
// export to memory stream
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();
var buffer = new Buffer(data, "utf-8");
// store into a file
var fs = require("fs");
fs.writeFileSync(compiledReportPath, buffer);
callback(/* error */null, "DONE");
});
report.dictionary.databases.clear();
report.dictionary.databases.add(new Stimulsoft.Report.Dictionary.StiPostgreSQLDatabase("BloxSQL", "BloxSQL", connectionString));
report.dictionary.synchronize();
report.renderAsync(function () {
// export to memory stream
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();
var buffer = new Buffer(data, "utf-8");
// store into a file
var fs = require("fs");
fs.writeFileSync(compiledReportPath, buffer);
callback(/* error */null, "DONE");
});
Re: PDF export in Node with a report accessing databases
Hello
Ok.
Please let us know if you need any additional help.
Thank you.
Ok.
Please let us know if you need any additional help.
Thank you.