Images not appearing when saved as PDF
-
- Posts: 14
- Joined: Wed Jun 19, 2013 9:12 am
Images not appearing when saved as PDF
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?
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?
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Images not appearing when saved as PDF
Hello,
Please send us a sample report with test data that reproduces the issue for analysis.
Thank you.
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
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.
See attached sample.
- Attachments
-
- Demo-Blank-PDF-Node.zip
- (121 KiB) Downloaded 157 times
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Images not appearing when saved as PDF
Hello,
We need some additional time to investigate the issue, we will let you know about the result.
Thank you.
We need some additional time to investigate the issue, we will let you know about the result.
Thank you.
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Images not appearing when saved as PDF
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:
this code works correctly
Thank you.
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); }).
Thank you.
-
- Posts: 14
- Joined: Wed Jun 19, 2013 9:12 am
Re: Images not appearing when saved as PDF
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
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
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Images not appearing when saved as PDF
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.
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.