Replies: 8 comments
-
After checking this I found this problem on two points: The first one is from The second one is from the vue-pdf/src/components/composable.ts Line 2 in de24ae4 Using the legacy worker fix the second point but It's still required to add the polyfill for the first point. import PDFWorker from 'pdfjs-dist/legacy/build/pdf.worker.min?url' |
Beta Was this translation helpful? Give feedback.
-
This should works, It's important configure the legacy worker before using <script setup lang="ts">
+ import * as PDFJS from 'pdfjs-dist';
+ import LegacyWorker from 'pdfjs-dist/legacy/build/pdf.worker.min?url';
import { VuePDF, usePDF } from '@tato30/vue-pdf';
+ PDFJS.GlobalWorkerOptions.workerSrc = LegacyWorker
const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>
<template>
<div>
<VuePDF :pdf="pdf" />
</div>
</template> |
Beta Was this translation helpful? Give feedback.
-
Hi TaTo! |
Beta Was this translation helpful? Give feedback.
-
I am sorry to border you.
... |
Beta Was this translation helpful? Give feedback.
-
There are PR for this? |
Beta Was this translation helpful? Give feedback.
-
@ZumelzuR Nope, this issue can be fixed using #127 (comment) It is not necessary to do something on source code. |
Beta Was this translation helpful? Give feedback.
-
I saw that there are some code in master (that is doing this PDFJS.GlobalWorkerOptions.workerSrc = LegacyWorker) but is there is not a compiled version of this. Would be great have this master changes on a compiled version :) |
Beta Was this translation helpful? Give feedback.
-
I add import * as PDFJS from "pdfjs-dist";
import LegacyWorker from "pdfjs-dist/legacy/build/pdf.worker.min?url";
import { VuePDF, usePDF } from "@tato30/vue-pdf";
import "@tato30/vue-pdf/style.css";
PDFJS.GlobalWorkerOptions.workerSrc = LegacyWorker; But it does not work. |
Beta Was this translation helpful? Give feedback.
-
Hello, this issue is not a bug but I need some help.
I‘m using version 1.10.0 of this repository, and in older versions of Chrome (earlier than 105), Promise.withResolvers is not supported, causing an error when I preview PDFs: Promise.withResolvers is not a function.
I tried using Babel to support it or ask ChatGPT, but it didn't work. Can anyone help me?
I have tried this:
yarn add @babel/core @babel/preset-env @vitejs/plugin-vue vite-plugin-babel -D
yarn add promise-polyfill
vite.config.js:
main.js:
Beta Was this translation helpful? Give feedback.
All reactions