未捕获的ReferenceError:初始化PDF.JS时未定义PDFJS
我正在尝试在各种CMS中安装PDF.JS,其中为我构建了页面的外部骨架,包括对jQuery的引用(仍然是版本1.10.2)。
我试过添加这两行:
并运行此命令:
PDFJS.getDocument('/loc/testpdf.pdf');
但他们返回此错误:
VM485:14 Uncaught ReferenceError: PDFJS is not defined at eval (eval at (jquery.js?v=910.1:4), :14:1) at eval () 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. (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'); })