# pdfjs-mozilla构建版本 **Repository Path**: jianshenggit/pdfjs-mozilla-build-version ## Basic Information - **Project Name**: pdfjs-mozilla构建版本 - **Description**: pdf预览(vue2);vue3暂时没试验过 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2023-11-01 - **Last Updated**: 2024-03-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # pdf-mozilla [在线演示地址](http://jianshenggit.gitee.io/pdfjs-mozilla-build-version) ### 使用 mozilla 的 pdfjs 构建版本 所以不需要安装任何东西,整个构建版本的包大约在16M左右,但实际使用时,首次需要加载的资源大概在2M左右 ![](/src/assets/pdf_1.png) ![](/src/assets/pdf_2.png) ### 功能 ```js props: { /** pdf的完整文件路径 */ url: { type: String, default: '' }, /** 是否支持打印 */ print: { type: Boolean, default: false }, /** 是否支持保存 */ save: { type: Boolean, default: false }, /** 是否支持编辑 */ edit: { type: Boolean, default: false } }, ``` ### 迁出方式 - 将 `public/pdfjs` 文件夹整体放到项目中 - 前端组件位置 `src/components/pdfMoz.vue` - 使用参照 `src/views/HomeView.vue` ### 需要注意的是 `src/components/pdfMoz.vue` 中 ```js data () { return { baseUrl: 'pdfjs/web/viewer.html?', fullPath: 'pdfjs/web/viewer.html' } }, // 这里的两个路径跟随项目而定 (前面要不要加 /, 或者 /项目部署路径/ 等) ```