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

[Question] Is that possible to run dom-to-image on NodeJS? #48

Open
BrunoQuaresma opened this issue Sep 25, 2021 · 8 comments
Open

[Question] Is that possible to run dom-to-image on NodeJS? #48

BrunoQuaresma opened this issue Sep 25, 2021 · 8 comments

Comments

@BrunoQuaresma
Copy link

Hi folks,

Just a quick question. Is that possible to run dom-to-image on NodeJS?

@ghost
Copy link

ghost commented Sep 29, 2021

You need window.getComputedStyle, so perhaps a headless browser instance would make it work

@BrunoQuaresma
Copy link
Author

Yes, I'm already using a headless browser, but it is pretty slow, so I was trying to find a better alternative. Thank you.

@ghost
Copy link

ghost commented Oct 1, 2021

Crazy idea - just use https://github.com/jsdom/jsdom

@BrunoQuaresma
Copy link
Author

I tried, but it didn't work. It gets an error related to canvas even after use node-canvas. 😞

@ghost
Copy link

ghost commented Oct 1, 2021

@zm-cttae
Copy link

zm-cttae commented Dec 21, 2022

There was a perf-hitting extreme CSS optimisation added in #37 for SVGs.

  • It got switched off for raster images in December - v2.9.5.
  • A 12.5-times-faster (but around 40-50% as good) CSS reducer was added for raster images about 5 months ago in Remove default styles #71 - v2.10.1
  • v2.13.1 - released yesterday - removed the stronger SVG optimization.

There's plans to bring it back in #92 as a much quicker post-processing op.
Choice of browser is also probably important. But I have no data to suggest anything more than "maybe MS Edge".

@yelban
Copy link

yelban commented Dec 27, 2022

Curious to know if it works with node + jsdom

@anshumanv
Copy link

Revisiting here in 2024...

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

4 participants