-
Notifications
You must be signed in to change notification settings - Fork 22
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
Notes on supporting node-canvas^3.0.0 #228
Comments
Hey, overriding It's a bit annoying that I personally can't compile the v3 pre-release of `node-canvas` but I'll revisit this once it's released or more stablenpm ERR! ../src/Image.cc: In member function ‘cairo_status_t Image::loadSVGFromBuffer(uint8_t*, unsigned int)’:
npm ERR! ../src/Image.cc:1141:3: error: ‘rsvg_handle_get_intrinsic_size_in_pixels’ was not declared in this scope; did you mean ‘rsvg_handle_get_intrinsic_dimensions’?
npm ERR! 1141 | rsvg_handle_get_intrinsic_size_in_pixels(_rsvg, &d_width, &d_height);
npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! | rsvg_handle_get_intrinsic_dimensions |
Thanks for the reply! Since this is such a new change, I'm going to bring it up over in the the node-canvas PR... Maybe the read only behavior is just an oversight. |
To follow-up here, it is confirmed by node-canvas team (Automattic/node-canvas#2235 (comment)) that it was indeed just an oversight and they will fix when they have some time but also requested if anyone can for a PR they will approve. As @abrenoch mentioned in that thread, I as well do not have C++ experience so if someone else wants to take a look that would be wonderful! |
Hey there.
As noted in #225, there is an upcoming major release of
node-canvas
that appears to actually compile correctly with electron. I have been testing this withpdf-to-img
, and it more or less works... But there is an issue I encountered I wanted to bring up because I think it will need to be addressed in some capacity or another. I'm not sure if this is apdfjs
orpdf-to-img
problem (actually I'm about certain it is apdfjs
problem, but the canvas dependency resides in this repo).First things first, my
package.json
looks something like this:This appears to work as expected and installs the
3.0
version of canvas.My test file looks like this:
When running the file, I'm presented with this error:
Looking under the hood of
pdfjs
, the problem seems to arise from themirrorContextOperations
function, which is overwriting many of the built-in canvas context methods such assave
,restore
,scale
, etc.This doesn't seem to have been an issue for the previous version of canvas, but looking over some of the update it received to support NAPI, it seems like those methods are now defined as read-only properties.
Now I'm not sure if this is really an issue for this repo or for the
pdfjs
one. The problem certainly comes from their usage of the canvas context, but considering they don't even have a canvas dependency, I thought maybe this was the place to start. Maybe a sort of proxy object or something that would allow the methods overridden inmirrorContextOperations
to be done so safely.Just wanted to open a discussion!
The text was updated successfully, but these errors were encountered: