Page 1 of 1
Images not appearing when saved as PDF
Posted: Sun May 17, 2020 2:33 pm
by richierich
I have a report which I created using the JavaScript stiDesigner control, and when I view it from within the designer (preview) or directly from the stiViewer, the images appear fine. I'm using the image control, and a hyperlink which points to a field containing the URL.
As I said, this appears fine within the Stimulsoft viewer, but when I 'Save as PDF' the images just appear as a grey square.
I've seen a few other posts which suggest using renderAsync() but I'm not using code to render this, I'm just using the built-in "Save as PDF". Also if I print, it's the same.
I'm using
Version 2020.1.2 from 17 January 2020, PHP, JS
Can you suggest how I can get this working please?
Re: Images not appearing when saved as PDF
Posted: Mon May 18, 2020 7:29 pm
by Lech Kulikowski
Hello,
Please send us a sample report with test data that reproduces the issue for analysis.
Thank you.
Re: Images not appearing when saved as PDF
Posted: Mon Aug 10, 2020 7:19 pm
by grbspltt
I'm having the same issue, been banging my head against the wall for hours on this. Glad to see its not just me.
See attached sample.
Re: Images not appearing when saved as PDF
Posted: Fri Aug 14, 2020 8:56 am
by Lech Kulikowski
Hello,
We need some additional time to investigate the issue, we will let you know about the result.
Thank you.
Re: Images not appearing when saved as PDF
Posted: Tue Aug 18, 2020 5:57 pm
by Lech Kulikowski
Hello,
1. you write about a picture from Url, and in the example you have a picture from resources. they have different behavior.
2. please send the original image you have in your report for analysis. We can't figure out what format it is.
3. you write "I'm not using code to render this" but in the example the report is rendered and exported from the code.
Below is your corrected code of how to export correctly:
Code: Select all
report.renderAsync(function () {
var data = report.exportDocumentAsync(function(buf) {
var buffer = new Buffer(buf, "utf-8");
var fs = require("fs");
fs.writeFileSync("Report.pdf", buffer);
}, Stimulsoft.Report.StiExportFormat.Pdf); }).
this code works correctly
Thank you.
Re: Images not appearing when saved as PDF
Posted: Thu Nov 05, 2020 11:15 pm
by richierich
Hello.
I think the confusion is because it was a different user that said they're having the same issue, and THEY posted an example.
I already mentioned that I'm using the built in "Save as PDF", I'm not rendering in code..
Rich
Re: Images not appearing when saved as PDF
Posted: Fri Nov 06, 2020 2:59 pm
by Lech Kulikowski
Hello,
If an image is loaded via URL from JS code, the console will get this kind of error:
"Access to XMLHttpRequest at 'https://.......png' from origin 'https://......' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
It is described for example here:
https://developer.mozilla.org/en-US/doc ... llowOrigin
To upload an image from another domain, you must first give permission to upload from this domain.
In the preview the picture is loaded by the browser itself, it does not need permission, so the picture is displayed.
To export it to pdf you need to upload it from code to embed it in pdf.
Thank you.