Exporting a Report to PDF
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.Reports can be rendered and exported to PDF entirely on the server. This example renders a template and writes the PDF to a file.
Exporting the document. Load and render the report, configure the requested export format, and deliver the generated bytes as a file, stream, or web response.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

Exporting the document. Load and render the report, configure the requested export format, and deliver the generated bytes as a file, stream, or web response.
var Stimulsoft = require('stimulsoft-reports-js');
var report = new Stimulsoft.Report.StiReport();
report.loadFile("SimpleList.mrt");
report.renderAsync(() => {
report.exportDocumentAsync((pdfData) => {
var buffer = Buffer.from(pdfData);
fs.writeFileSync('./SimpleList.pdf', buffer);
}, Stimulsoft.Report.StiExportFormat.Pdf);
});exportDocumentAsync returns the PDF as a byte array; wrapping it in a Node Buffer and calling fs.writeFileSync saves it to disk. This is the basis for server-side report delivery, e-mail attachments and scheduled exports.На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
