Cors Error on loading image

Stimulsoft Dashboards.WEB discussion
Post Reply
Mahdy
Posts: 2
Joined: Sun Aug 15, 2021 12:07 pm

Cors Error on loading image

Post 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.
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Cors Error on loading image

Post 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.
Mahdy
Posts: 2
Joined: Sun Aug 15, 2021 12:07 pm

Re: Cors Error on loading image

Post by Mahdy »

Thank you for your reply Lech Kulikowski. I got the point but the problem is not solved.
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Cors Error on loading image

Post 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.
Post Reply