尝试安装pdf.js

This commit is contained in:
zhbaor 2021-11-01 23:23:28 +08:00
parent 00418e1c02
commit 316b7f1e05
3 changed files with 11 additions and 0 deletions

View file

@ -11,6 +11,7 @@
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.6.1",
"core-js": "^3.6.5",
"pdfjs-dist": "^2.10.377",
"vue": "^3.0.0"
},
"devDependencies": {

View file

@ -48,6 +48,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import * as pdfjsLib from 'pdfjs-dist';
export default defineComponent({
name: 'App',
@ -62,5 +63,9 @@ export default defineComponent({
],
};
},
mounted() {
pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
pdfjsLib.getDocument('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/examples/learning/helloworld.pdf');
},
});
</script>

View file

@ -6820,6 +6820,11 @@ pbkdf2@^3.0.3:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
pdfjs-dist@^2.10.377:
version "2.10.377"
resolved "https://registry.npmmirror.com/pdfjs-dist/download/pdfjs-dist-2.10.377.tgz#feadc9f31bf1790795994e54b18930974cf4970a"
integrity sha1-/q3J8xvxeQeVmU5UsYkwl0z0lwo=
performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.nlark.com/performance-now/download/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"