尝试安装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

@ -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>