html-to-canvas | Takes HTML styled with CSS and draws the equivalent | Canvas library
kandi X-RAY | html-to-canvas Summary
kandi X-RAY | html-to-canvas Summary
Takes HTML styled with CSS and draws the equivalent to a canvas tag automagically.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of html-to-canvas
html-to-canvas Key Features
html-to-canvas Examples and Code Snippets
Community Discussions
Trending Discussions on html-to-canvas
QUESTION
I'm trying to find a way to make a screenshot of DOM-node on client-side. The best option I've come up with is wrapping DOM-node in and placing it to SVG. Then SVG goes to a
canvas
and then it can be converted to all other formats as a Blob
.
Everything works fine except the fonts. Custom fonts works only in inline SVG, but not in SVG as a separate file. I need to embed them as a Blob.
And here comes a problem: some of these fonts are hosted on Google fonts, so there is no way to get their blobs at runtime because of CORS-restrictions.
I've already tried html2canvas
library and it is not reliable for my purposes. Same for dom-to-canvas
and html-to-canvas
. They don't solve the problem with fonts.
Also I've tried to rasterize all children text-blocks in the DOM-node, but result is far from perfect.
Server-side solution is possible, but I'd like to avoid it.
Is there something I've missed?
...ANSWER
Answered 2019-Aug-29 at 11:08So I've come up with creating proxy on my server for fetching cors-fonts and css.
I check styles font imported styles and font-face rules and create new ones for svg with embedded fonts and styles.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install html-to-canvas
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page