I'm looking for a way of capturing a section of a web page as a transparent-backgrounded PNG. This would mean that the transparent
background property would be truly transparent. A root level element, instead of displaying white, would create a png with a transparent background.
However, I suspect the behavior I'm looking for just isn't possible. My next guess at the problem would be to create a canvas element, and somehow draw a html fragment onto the canvas. From there, capturing a PNG is trivial.
To summarise my two questions:
- Is there a relatively simple way of capturing an HTML document fragment as a PNG, such that a root nodes
background: transparent
property truly results in transparency? - If not, can I draw an HTML document fragment to a canvas element, and if so, will I get the wanted behaviour?