Page 1 of 1

Cors Error on loading image

Posted: Sun Aug 15, 2021 12:24 pm
by Mahdy
I can't figure out this issue. I have an image jpeg that is going to show from url, this URL is a field of a table.
In my report I selected hyperLink from the options.
I use angular and stimulsoft report.
When I load the viewer, The image is showing well, but when I want to print or export as pdf, the image is not shown. when I console it gives the cors error in the console.
zone.js:3353 Not allowed to load local resource: file:///F:/JsonReport/LoginBranchDetails.json
(anonymous) @ zone.js:3353
zone.js:3353 Not allowed to load local resource: file:///F:/JsonReport/sales.json
(anonymous) @ zone.js:3353
zone.js:3353 Access to XMLHttpRequest at 'http://IP_Address/api/images/BE/small.0faa4ac2-29c8-4769-b2cd-d1ccf511cfc3.jpg' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
(anonymous) @ zone.js:3353
zone.js:3353 Failed to load resource: net::ERR_FAILED
(anonymous) @ zone.js:3353
zone.js:3353 Not allowed to load local resource: file:///C:/Users/Public/Pictures/Sample%20Pictures/Chrysanthemum.jpg

The image is not a watermark.

I'm using ultimate 2019.2.3 with license ultimate.

The main problem is that the client does not have access to the location which image is located. image saved into the folder and the address is taken from the field of a table.

I searched a lot but I couldn't find any way to solve the problem please help me.

Re: Cors Error on loading image

Posted: Tue Aug 17, 2021 7:05 am
by Lech Kulikowski
Hello,

Please check the following article:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

If the browser itself cannot upload a picture and swears at CORS, then CORS is not allowed.

In the designer preview, it is shown because HTML img tags are created and the URL to the pictures are indicated in src to which the browser responds perfectly without CORS. But to export to pdf images is needed to load as data, and then the browser talks about the security of downloading from other domains and it is not possible without CORS allowed.

Thank you.

Re: Cors Error on loading image

Posted: Tue Aug 17, 2021 8:23 am
by Mahdy
Thank you for your reply Lech Kulikowski. I got the point but the problem is not solved.

Re: Cors Error on loading image

Posted: Tue Aug 17, 2021 8:39 am
by Lech Kulikowski
Hello,

There is no other solution.

In your log, you can see the error reason:
zone.js:3353 Access to XMLHttpRequest at 'http://IP_Address/api/images/BE/small.0faa4ac2-29c8-4769-b2cd-d1ccf511cfc3.jpg' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.