Created
May 20, 2014 14:16
-
-
Save itsjavi/b3f22505776b097ec914 to your computer and use it in GitHub Desktop.
Convert an HTML element to a PNG image with html2canvas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // this demo works in http://html2canvas.hertzen.com/examples.html | |
| var $w = window; | |
| html2canvas($('.btn:first').get(0), { | |
| onrendered: function(canvas) { | |
| var win = $w.open(); | |
| win.document.write('<img src="'+canvas.toDataURL("image/png")+'"/>'); | |
| } | |
| }); | |
| // project repo: https://github.com/niklasvh/html2canvas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@itsjavi which version has been used here? update your gist, the API from
html2canvaschanged.