Javascript devs, what's the best HTML-to-Image con...
# random
m
Javascript devs, what's the best HTML-to-Image conversion library out there? Ideally should: 1. Support the usual 
PNG
 | 
JPG
 | 
SVG
 | 
PDF
 formats. 2. Be an NPM package that runs in-browser (i.e. no back-end required). Preferably open-source & free. But don't mind paid licenses.
e
https://imgproxy.net/ Once you set this up, you don’t have to think about images again.
m
Thanks, but see my point #2 above 😃
b
Html2Canvas might be your best bet
👍 1
a
dom2image for PNG, JPG, SVG: https://www.npmjs.com/package/dom-to-image (it's better than html2canvas) dom2pdf for PDF: https://www.npmjs.com/package/dom-to-pdf Past week I wrote a tutorial on generating an image and copying it to clipboard in JS, let me know if you think it would be helpful for you!
👍 1
f
If you're doing it on the backend and want more granular control, Puppeteer is a good option.