Page 1 of 1

Problem with images when export to PDF

Posted: Fri Jun 01, 2018 11:13 pm
by agodoo
Hello,
I'm using your report.JS version. I have a simple report where I need to insert a company logo in the header.

As I will run and view the report on Apache as a web page, I tried inserting the logo image using the image control, and setting hyperlink as "http://localhost:8080/myapp/reports/logo-report.png"

If I open my report.html page it shows, but when I export the report to pdf with the following code, the image is not present in the PDF.

Code: Select all

        // 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);

        report.reportName = "MyReport";
        report.reportAlias = "MyReport";
        // 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(data, fileName + ".pdf", "application/pdf");


How can I fix this problem?

kind regards,
Matteo

Re: Problem with images when export to PDF

Posted: Mon Jun 04, 2018 8:15 pm
by Lech Kulikowski
Hello,

Please try to use the exportToAsync() method.

Thank you.