-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
structuredClone is not defined #14729
Comments
When using the PDF.js library in Node.js you must use a
Note that that's never recommended, since anything except the latest version is explicitly unsupported. |
@Snuffleupagus thoughts on when this would work on non-legacy version? |
Just FYI, I'm using the following versions and now everything is working perfectly. Node: 18.9.0 import { getDocument, PDFDocumentProxy } from 'pdfjs-dist';
...
let pdf: PDFDocumentProxy | undefined = await getDocument({url: noteFullPath, password: pass}).promise; |
Importing it from legacy as suggested by @Snuffleupagus works:
|
Hello I am unable to find the legacy version. Is it still available? |
import pdfjsLib from 'pdfjs-dist/legacy/build/pdf.js'; needs canvas which I don't have in node.js 16? |
solution: import pdfjsLib from 'pdfjs-dist/legacy/build/pdf.js' mozilla/pdf.js#14729 (comment)
Attach (recommended) or Link to PDF file here:
Configuration:
Actually using Node.JS 16.13.0
Windows 10 64 bits
2.13.216
No
Steps to reproduce the problem:
node
What is the expected behavior? (add screenshot)
No error should be reported
What went wrong? (add screenshot)
An error is reported
Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):
Notes:
I was using PDF version 2.7.570 and I didn't have this issue. I saw that the polyfill for
structuredClone
was removed recently. I'd like to know if there's any workaround for my case. For now, I'm just downgrading the version that I use. Thank you!The text was updated successfully, but these errors were encountered: