Trouble integrating PDF.js v4.2.67 into AMD (Dojo) environment like Alfresco Share #20158
debjit-chattopadhyay-hyland
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
📘 Background
I'm upgrading PDF.js in an enterprise legacy system (Alfresco Share) which uses AMD via Dojo.
PDF.js v2.5.207 worked fine, but I want to use the latest stable (v4.2.67) to fix security vulnerability
https://codeanlabs.com/blog/research/cve-2024-4367-arbitrary-js-execution-in-pdf-js/
The modern PDF.js builds (including legacy builds) seem to only ship
.mjsfiles using ES modules.However, Alfresco Share requires scripts in UMD or AMD format, so they can be loaded using
define()in Dojo.When I try to use the
.mjsfiles directly or transpile them manually, I encounter:SyntaxError: Unexpected token 'export'Error: multipleDefinepdfjsLib is not defined✅ What I Tried
pdfjs-4.2.67-dist.zipand tried files underlegacy/andbuild/.@babel/plugin-transform-modules-umd.pdf.jsandpdf.worker.jsin Share with UMD-wrapped versions.pdfjsLib.GlobalWorkerOptions.workerSrcis set properly.🤔 What I Need Help With
Does PDF.js still publish UMD builds?
.mjsto UMD manually?Is there a
pdf.worker.jsUMD-compatible version available?Are there plans to provide better backward compatibility for AMD/UMD environments?
Thanks in advance! 🙏
Beta Was this translation helpful? Give feedback.
All reactions