export existing document with included image (base64) to pdf
Posted: Fri Oct 04, 2019 1:52 pm
Hallo,
we want read saved documents, export to pdf and send the data to the client (because the docuemnt text in browser is not complete). The .mdc document was created with die .net version of Stimulsoft Reports (see attachment).
My code:
var fs = require('fs'),
sr = require('stimulsoft-reports-js');
fs.readFile(path, (err,data)=>{
if (err) throw err;
sr.Base.StiLicense.loadFromFile('./app/license.key');
var report = new sr.Report.StiReport();
report.loadDocument(new Uint8Array(data));
var settings = new sr.Report.Export.StiPdfExportSettings();
var service = new sr.Report.Export.StiPdfExportService();
var stream = new sr.System.IO.MemoryStream();
service.exportPdf(report, stream, settings);
var bytes = stream.toArray();
var result = sr.System.Convert.toBase64String(bytes);
//send result via websocket
});
But I get a very wrong result. Please help.
Thanks in advance.
we want read saved documents, export to pdf and send the data to the client (because the docuemnt text in browser is not complete). The .mdc document was created with die .net version of Stimulsoft Reports (see attachment).
My code:
var fs = require('fs'),
sr = require('stimulsoft-reports-js');
fs.readFile(path, (err,data)=>{
if (err) throw err;
sr.Base.StiLicense.loadFromFile('./app/license.key');
var report = new sr.Report.StiReport();
report.loadDocument(new Uint8Array(data));
var settings = new sr.Report.Export.StiPdfExportSettings();
var service = new sr.Report.Export.StiPdfExportService();
var stream = new sr.System.IO.MemoryStream();
service.exportPdf(report, stream, settings);
var bytes = stream.toArray();
var result = sr.System.Convert.toBase64String(bytes);
//send result via websocket
});
But I get a very wrong result. Please help.
Thanks in advance.