Support of Canvas #10

Closed
younes0 opened this Issue Aug 21, 2011 · 5 comments

Comments

Projects
None yet
2 participants

younes0 commented Aug 21, 2011

html2canvas doesn't support Canvas.
Is this feature part of the roadmap ?
I know that SVG support is planned according to the author's Tweeter page.

Owner

niklasvh commented Sep 5, 2011

Canvas images can be supported as long as they are not restricted with security settings (i.e. they can be outputted with toDataUrl).

As for SVG, I most likely won't create something just for this script, as there are perfectly fine open source scripts that do this already (convert SVG to canvas), such as canvg (http://code.google.com/p/canvg/) which could just be used with this script.

niklasvh closed this Sep 5, 2011

younes0 commented Sep 9, 2011

Why do I ask for a canvas support:
I use html2canvas in order to print, or save as image, rendered maps with OpenLayers, a very popular Open-Source map rendering library.
example : http://dev.openlayers.org/releases/OpenLayers-2.10/examples/

The default browser print action makes something ugly and there are no javascript based client-side functionnality to print maps yet.
The server side functionnality works fine but it requires server components that I can't setup.

As you can see on the map, there are multiple image tiles and a SVG or Canvas (if supported) layer.
So I use html2canvas to print the map, everything works fine except the Canvas that is NOT included on the printed map.

So in your last message, did you mean that I should do a toDataURL export of the OpenLayers canvas layer(s) and merge it with the html2canvas generated canvas ?

Owner

niklasvh commented Sep 9, 2011

For now, I'd recommend that.

I am in the process of rewriting a lot of the code and restructuring it (have a look under dev branch). At some point I will add support for loading canvas images straight into the canvas with (getImageData and putImageData), but until then I'd recommend keeping the canvas layers separate.

There are a lot of css attributes and elements which aren't supported so I wouldn't recommend putting this script into a production environment yet.

@ghost

ghost commented Apr 23, 2013

Hey, svg still sin't supported by html2canvas. Can we expect it to be coming soon?

@ghost

ghost commented Apr 23, 2013

As you said that svg to canvas is possible with canvg, but neither canvg nor html2canvas are helpful if my code contains both svg graphs and html elements. Is there any way i could resolve this issue? My code has both svg and html and I want to take a screenshot of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment