Image not showing when Export to pdf from Code

Stimulsoft Reports.JS discussion
agent354
Posts: 3
Joined: Thu Sep 07, 2017 6:34 pm

Re: Image not showing when Export to pdf from Code

Post by agent354 »

I am also experiencing issues with trying to load an image when exporting to PDF. The image will load just fine in the viewer, but when I use java script code to export to PDF, the image is missing. I also tried to load the image as a resource, still no luck.

report.render();

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

var content = Stimulsoft.System.IO.Http.getFile(dataObj[0].PictureUrl, true);
var resource = new Stimulsoft.Report.Dictionary.StiResource("Image", "Image", false, Stimulsoft.Report.Dictionary.StiResourceType.Image, content);
report.dictionary.resources.add(resource);

I tried with JPG and with PNG.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Image not showing when Export to pdf from Code

Post by HighAley »

Hello.

Here is a PDF that we get after the export.
If it's right, please, try our latest build.

Thank you.
Attachments
ExportPdf.pdf
(223.78 KiB) Downloaded 388 times
Post Reply