Replies: 2 comments
-
With no reproduction is really difficult to understand what's going on. I suggest placing a breakpoint at pdf.js/src/display/display_utils.js Line 482 in ccad2f8 _document is set to undefined.
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately that makes this issue, or any issue really, non-actionable.
Please see https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):
In that case, this unfortunately seems unrelated to the PDF.js library. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Attach (recommended) or Link to PDF file
I can't add a example of the PDFs I'm using because they are proprietary.
Web browser and its version
Chrome 126
Operating system and its version
OSX Ventura
PDF.js version
4.0.379
Is the bug present in the latest PDF.js version?
Yes
Is a browser extension
No
Steps to reproduce the problem
Make a call to the
pdf.getPage.render
method:What is the expected behavior?
pdf.getPage.render
should not error and paint the pdf to the passedcanvas
context.What went wrong?
An error is thrown:
The
this
in the linethis._document.createElement("canvas");
isundefined
.Link to a viewer
No response
Additional context
We recently moved from Create React App to Vite and this issue was only noticed after that so it must have something to do with that.
This doesn't happen with all the PDFs we use but it happens on about 90% of them.
We use
pdfjs
installed from NPM and have the worker file in the public folder using:to set up the
GlobalWorkerOptions.workerSrc
.I tried updating to the latest version of PDFJS but got the same error.
Beta Was this translation helpful? Give feedback.
All reactions