I'm still fairly new to PDF.js. I'm trying to link my viewer.html with my pdf which are located in another server, eg: 100.0.55.10. Code shown below is how I embed the pdf in my iframe.
//LocalDir = http:///127.0.0.1/Main/Apps/Document/web
//BookLoc = http:///100.0.55.10/pdfFolder/pdfname.pdf
<iframe id="framePDF" name="framePDF" src="#LocalDir#/viewer.html?file=#BookLoc#" frameborder="0" height="500px" width="100%"></iframe>
I've managed to go around the issue with CORS by changing the mode in viewer.js to 'no-cors'. However, now it can't retrieved the pdf from the server 100.0.55.10.
I'm still fairly new to PDF.js. I'm trying to link my viewer.html with my pdf which are located in another server, eg: 100.0.55.10. Code shown below is how I embed the pdf in my iframe.
//LocalDir = http:///127.0.0.1/Main/Apps/Document/web
//BookLoc = http:///100.0.55.10/pdfFolder/pdfname.pdf
<iframe id="framePDF" name="framePDF" src="#LocalDir#/viewer.html?file=#BookLoc#" frameborder="0" height="500px" width="100%"></iframe>
I've managed to go around the issue with CORS by changing the mode in viewer.js to 'no-cors'. However, now it can't retrieved the pdf from the server 100.0.55.10.
Share Improve this question edited Jul 5, 2019 at 2:18 jdow asked Jul 4, 2019 at 8:36 jdowjdow 591 gold badge1 silver badge11 bronze badges 01 Answer
Reset to default 0Have you tried the solution suggested here? It sounds like you might be able to resolve it with additional CORS configuration: https://github./mozilla/pdf.js/issues/4530
There's some good information in the FAQ for PDF.js: https://github./mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr