-
how use Web Worker Loading in vite |
Beta Was this translation helpful? Give feedback.
Answered by
hrynko
Mar 27, 2024
Replies: 1 comment 2 replies
-
Hi @newives, In essence, you just need to install proper versions of npm i vue-pdf-embed@2 pdfjs-dist@3.11.174 And then import the PdfWorker from <script setup>
import { GlobalWorkerOptions } from 'vue-pdf-embed/dist/index.essential.mjs'
import PdfWorker from 'pdfjs-dist/build/pdf.worker.js?url'
import 'vue-pdf-embed/dist/style/index.css'
GlobalWorkerOptions.workerSrc = PdfWorker
const pdfSource = '<PDF_URL>'
</script>
<template>
<VuePdfEmbed :source="pdfSource" />
</template> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
hrynko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @newives,
In essence, you just need to install proper versions of
vue-pdf-embed
andpdfjs-dist
as dependencies.And then import the PdfWorker from
pdfjs-dist
as a URL (see?url
) and set it to theGlobalWorkerOptions
imported fromvue-pdf-embed
.