我正在尝试在某种内容管理系统中安装PDF.JS,其中页面的外部框架是为我构建的,包括对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版本有关?
谢谢
发布于 2018-02-07 00:54:00
尝试在页面加载后运行脚本;
$(document).ready(function () {
PDFJS.getDocument('/loc/testpdf.pdf');
})
https://stackoverflow.com/questions/48647838
复制相似问题