PDF.js 消息:检索 PDF 时出现意外的服务器响应 (0)

问题描述 投票:0回答:1

我对 PDF.js 还很陌生。我正在尝试将我的viewer.html 与位于另一台服务器中的pdf 链接,例如:100.0.55.10。下面显示的代码是我如何将 pdf 嵌入到我的 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>

我通过将viewer.js 中的模式更改为“no-cors”,成功解决了 CORS 问题。但是,现在无法从服务器 100.0.55.10 检索 pdf。

javascript pdf pdf.js
1个回答
0
投票

您尝试过此处建议的解决方案吗?听起来您也许可以通过额外的 CORS 配置来解决它:https://github.com/mozilla/pdf.js/issues/4530

PDF.js 的常见问题解答中有一些很好的信息:https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr

© www.soinside.com 2019 - 2024. All rights reserved.