Export to PDF using toolbar and code

Stimulsoft Reports.PHP discussion
Post Reply
qiera
Posts: 1
Joined: Mon Nov 14, 2016 6:13 am

Export to PDF using toolbar and code

Post by qiera »

I am doing some experiment with this sample https://www.stimulsoft.com/en/samples/j ... ort-to-pdf

i found that you can't export report with image using this method, new pdf will be created but if there are image in that report, the image will be empty,

however you can export correctly using viewer toolbar

attached are the sample report, pdf created using sample method, and pdf created using viewer toolbar export to pdf

we want to export report to pdf via custom button but a lot of our report include one or more image
Attachments
report_toolbar.pdf
(17.46 KiB) Downloaded 246 times
report_direct.pdf
(12.25 KiB) Downloaded 311 times
test.mrt
(8.18 KiB) Downloaded 215 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Export to PDF using toolbar and code

Post by Alex K. »

Hello,

Thank you for the sample.
We have found some issues. We need some time to fix the issue. We will let you know about the result.

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Export to PDF using toolbar and code

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/test.mrt");
report.render();
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.exportToAsync(function () {                 
    var data = stream.toArray();                 
    // Get report file name                 
    var fileName = String.isNullOrEmpty(report.reportAlias) ? report.reportName : report.reportAlias;         
    // Save data to file                 
    Object.saveAs(data, fileName + ".pdf", "application/pdf");
}, report, stream, settings);
Thank you.
Post Reply