@4tw/vue-cli-plugin-pdfjs-viewer 中文文档教程
vue-cli-plugin-pdfjs-viewer
Mozilla pdf.js 查看器 作为 NPM 包。
Usage
此 vue-cli 插件会将所有必需的 pdf.js 文件复制到 public
文件夹中。 然后,查看器将在以下 URL 下可用:{BASE_URL}/pdfjs/web/viewer.html?file=/example.pdf
。
通过在 pluginOptions
下为 pdfjsPath
提供值,可以覆盖默认目标路径。 例如,通过将路径设置为 public/assets/pdfjs
,pdf.js 文件将在 {BASE_URL}/assets/pdfjs/web/viewer.html?file=/example 下可用。 pdf
.
Updating
为了更新查看器,pdf.js 需要构建并将其复制到资产中 文件夹。 复制后必须将以下补丁应用到 viewer.html:
<style>
/* Hide upload and bookmark button */
#openFile, #viewBookmark {
display: none;
}
</style>
注意此补丁必须添加到 之后查看器.css
。
vue-cli-plugin-pdfjs-viewer
The mozilla pdf.js viewer as an NPM package.
Usage
This vue-cli plugin will copy all the required pdf.js files into the public
folder. The viewer will then be available under the following URL: {BASE_URL}/pdfjs/web/viewer.html?file=/example.pdf
.
By providing a value for pdfjsPath
under pluginOptions
the default target path can be overridden. For example by setting the path to public/assets/pdfjs
the pdf.js files will be available under {BASE_URL}/assets/pdfjs/web/viewer.html?file=/example.pdf
.
Updating
In order to update the viewer, pdf.js needs to be built and copied into the assets
folder. After copying the following patch must be applied to the viewer.html:
<style>
/* Hide upload and bookmark button */
#openFile, #viewBookmark {
display: none;
}
</style>
NOTE this patch must be added after the viewer.css
.