I am trying to load pdf from another server to the viewer of pdf.js in my server.I got error "PDF.js v1.4.20 (build: b15f335) Message: file origin does not match viewer's"
I already checked many answer, many of them said that pass the pdf url through a proxy like:- link
After searching a lot i found that they release a new patch in which they have lock down any CDR request, correct me if i am wrong:-Here is the link
but in their user manual they specified that it is possible here is the link
I tried all method but not able to enable CDR on my server and many methods didn't work.
Please help me to resolve this issue. My Basic idea is to show pdf(which is hosted on 3rd party server) on my pdf reader(that i made it from pdf.js).
I resolved this issue by comment this lines in viewer.js
if (fileOrigin !== viewerOrigin) {
throw new Error('file origin does not match viewer\'s');
}
and use proxy like this. http://192.168.0.101/web/viewer.html?file=https://cors-anywhere.herokuapp.com/pathofpdf.pdf
Add your domain/origin to HOSTED_VIEWER_ORIGINS
array
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With