Skip to content
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

Version 3.x with pdfjs error - Cannot assign to read only property #2446

Open
abrenoch opened this issue Oct 24, 2024 · 6 comments
Open

Version 3.x with pdfjs error - Cannot assign to read only property #2446

abrenoch opened this issue Oct 24, 2024 · 6 comments

Comments

@abrenoch
Copy link

Hey, taking a crack at getting the v3 of this library to play nicely with pdf.js, running into this error:

TypeError: Cannot assign to read only property 'clip' of object '#<CanvasRenderingContext2D>'

I mentioned this same issue with the save property in the PR here:
#2235 (comment)

Are there more read-only properties that need to be changed?

@rory-orennia
Copy link

I'm getting similar errors while trying to use Vega (https://github.com/vega/vega) on version 3.
TypeError: Cannot assign to read only property 'width' of object '#<Canvas>'. Then I patch the library to take out that line just to see if I can get it working and TypeError: Cannot assign to read only property 'globalCompositeOperation' of object '#<CanvasRenderingContext2D>. Take that out and then TypeError: Cannot assign to read only property 'globalAlpha' of object '#<CanvasRenderingContext2D>'. keep going TypeError: Cannot assign to read only property 'strokeStyle' of object '#<CanvasRenderingContext2D>. and again TypeError: Cannot assign to read only property 'lineWidth' of object '#<CanvasRenderingContext2D>' and finally TypeError: Cannot assign to read only property 'lineDashOffset' of object '#<CanvasRenderingContext2D>'.

After all that you get a beautiful chart of nothing because you took away all the drawing pieces 🤣

@abrenoch
Copy link
Author

abrenoch commented Nov 5, 2024

Actually it looks like there have been changes made since RC2 was released that may address this issue.

@zbjornson Any chance we could get some new prebuilds up with these changes? Pretty please! 🙏

@rory-orennia
Copy link

There's a few stories in Bun and Deno around this so it would be great to see how close we are with the latest changes:
oven-sh/bun#5835
denoland/deno#26347
denoland/deno#25974

The reason I was testing vega with node-canvas 3.0 was because I wanted to test the performance improvements of either bun or deno against our current node server, and version 2 is basically unusable in either of those newer runtimes

@Methuselah96
Copy link

Methuselah96 commented Nov 6, 2024

I am also experiencing these errors when using canvas with jsdom. @zbjornson Any chance we can get a new RC release with the fixes from #2409?

@prescottprue
Copy link

Also seeing this issue with pdfjs - would be awesome to see a new RC with the fixes as called out

@jacob-israel-turner
Copy link

The pdf.js team just removed the node-canvas dependency, so this shouldn't be an issue in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants