未接收参考:初始化pdf.js时未定义PDFJS



我正在尝试将PDF.JS安装在为我构建的页面的CMS中,其中包括对JQuery的引用(仍然是1.10.2版(。

我尝试添加这两行:

<script src="https://mozilla.github.io/pdf.js/build/pdf.js"></script>
<script src="https://mozilla.github.io/pdf.js/build/pdf.worker.js"></script>

和运行此命令:

<script>
    PDFJS.getDocument('/loc/testpdf.pdf');
</script>

但是他们返回此错误:

VM485:14 Uncaught ReferenceError: PDFJS is not defined
at eval (eval at <anonymous> (jquery.js?v=910.1:4), <anonymous>:14:1)
at eval (<anonymous>)
at jquery.js?v=910.1:4
at Function.globalEval (jquery.js?v=910.1:4)
at init.domManip (jquery.js?v=910.1:5)
at init.append (jquery.js?v=910.1:5)
at init.<anonymous> (jquery.js?v=910.1:5)
at Function.access (jquery.js?v=910.1:4)
at init.html (jquery.js?v=910.1:5)

我已经走了几个小时,试图弄清楚怎么了。我是否正确初始化了它,或者我们认为它与jQuery的过时版本有关?

谢谢

在加载页面后尝试运行脚本;

$(document).ready(function () {
    PDFJS.getDocument('/loc/testpdf.pdf');
})

由于版本的更改而给出此错误。最新版本不支持先前的版本功能。这就是为什么它会给您错误PDFJS is not define

最新更新