vue3使用pdf.js但显示异常

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

我是在https://mozilla.github.io/pdf.js/下载到本地的,版本是最新的,然后解压到项目的public文件夹下,使用下面的示例代码 enter image description here enter image description here 但是,浏览器显示异常。以下是显示效果和控制台异常代码。 enter image description here enter image description here

我已经尝试了很多,但我仍然很困惑。

vuejs3 pdf.js
1个回答
0
投票

你不能直接使用pdf.js的源代码,iframe可能是最简单的入门方式。

首先使用

gulp generic
安装和构建,请参阅 https://github.com/mozilla/pdf.js/#getting-the-code.

的分步说明。

构建完成后,应该有一个build目录,在build目录中找到web/index.html,你需要弄清楚index.html是如何工作的。

或者你可以尝试https://github.com/Priestch/document-viewer,我维护这个库并尝试让 pdf.js 更容易上手。

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