-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[api-minor] Attempt to prevent Node.js-specific polyfill errors from completely breaking the library #16733
[api-minor] Attempt to prevent Node.js-specific polyfill errors from completely breaking the library #16733
Conversation
…completely breaking the library The existing Node.js-specific polyfills depend on the `node-canvas` package, which has unfortunately (repeatedly) shown to cause trouble for many users. We attempted to improve the situation by listing the relevant packages as `optionalDependencies`, but that didn't seem to really fix the problem. With this patch the library should be able to load in Node.js-environments even if polyfilling fails, and any errors will instead occur during rendering. Obviously this is *not* a proper solution, since it basically moves the problem to another part of the code-base. However for certain "simpler" use-cases, such as e.g. text-extraction, these changes should hopefully improve general usability of the PDF.js library in Node.js-environments. *Please note:* For most PDF documents rendering should still work though, since `DOMMatrix` is *currently* only used with Patterns and `Path2D` only with Type3-fonts and Patterns.
/botio unittest |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/a5a2cbf94ca9537/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/877280b1071f319/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/a5a2cbf94ca9537/output.txt Total script time: 2.76 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/877280b1071f319/output.txt Total script time: 7.39 mins
|
/botio-windows unittest |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/744c78ca0e3f88c/output.txt |
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/744c78ca0e3f88c/output.txt Total script time: 10.25 mins
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you.
The existing Node.js-specific polyfills depend on the
node-canvas
package, which has unfortunately (repeatedly) shown to cause trouble for many users. We attempted to improve the situation by listing the relevant packages asoptionalDependencies
, but that didn't seem to really fix the problem.With this patch the library should be able to load in Node.js-environments even if polyfilling fails, and any errors will instead occur during rendering. Obviously this is not a proper solution, since it basically moves the problem to another part of the code-base. However for certain "simpler" use-cases, such as e.g. text-extraction, these changes should hopefully improve general usability of the PDF.js library in Node.js-environments.
Please note: For most PDF documents rendering should still work though, since
DOMMatrix
is currently only used with Patterns andPath2D
only with Type3-fonts and Patterns.