Pdf.Js Cors Issue

PDF.js CORS issue

Finally found the problem. My server was not passing the Access-Control-Allow-Credentials: true header to the response, which was needed (xhr request was sent with xhr.withCredential).

CORS is now working properly.

Found the solution at: https://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/

I get a Cross-Origin Request blocked when trying to use pdf.js

The problem is you can't read file from local system directly due to security issues. You need to run a simple web server to load pdf file form. This option you mentioned should be set on webserver side not your side. Try running simple static webserver available with npm,...

You can also use FileReader api to read files on system.



Related Topics



Leave a reply



Submit