我对PDF.js还是相当陌生的。我正在尝试链接我的viewer.html与我的pdf,它们位于另一台服务器上,例如: 100.0.55.10。下面显示的代码是我如何在iframe中嵌入pdf的。
//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>通过将viewer.js中的模式更改为“no- CORS”,我已经设法绕过了cors的问题。但是,现在它不能从服务器100.0.55.10检索pdf。

发布于 2019-07-05 11:35:24
您尝试过这里建议的解决方案了吗?听起来你也许可以通过额外的CORS配置来解决这个问题:https://github.com/mozilla/pdf.js/issues/4530
在PDF.js的常见问题解答中有一些很好的信息:https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr
https://stackoverflow.com/questions/56883808
复制相似问题