When/where does wasmUrl need to be set? #19666
Replies: 3 comments 2 replies
-
I think I'm having a similar issue: no longer works because it can't find qcms_wasm |
Beta Was this translation helpful? Give feedback.
-
@Snuffleupagus @calixteman Please could you advise on this? I've been holding off updating to v5 because I'm a bit unclear on this change. Is the Hello World example still up to date, or would it need changing to add |
Beta Was this translation helpful? Give feedback.
-
Ok! Dove into it today. Here's what I've found:
If you are just using the default web viewer, most probably no as it loads
This is related to #19761 and #19801. ATM loading the v5 worker through webpack is broken. To work around it, you should replace this: import * as pdfjsLib from 'pdfjs-dist/webpack.mjs';
const pdfUrl = '/your/public/file.pdf';
pdfjsLib.getDocument(pdfUrl); With this: import * as pdfjsLib from 'pdfjs-dist';
import pdfWorkerURL from 'file-loader!pdfjs-dist/build/pdf.worker.mjs';
pdfjsLib.GlobalWorkerOptions.workerPort = new Worker(pdfWorkerURL, { type: 'module' });
const pdfUrl = '/your/public/file.pdf',
wasmUrl = '/your/public/pdfjs/web/wasm/';
pdfjsLib.getDocument({url: pdfUrl, wasmUrl: wasmUrl}); This is a workaround! It should be reverted when |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using pdf.js from a CDN in a web application, to render PDF pages to a canvas (similar to the Hello World example). When upgrading to v5, is it necessary to set
wasmUrl
in this use case? If so, how/where do I set it?Beta Was this translation helpful? Give feedback.
All reactions