Created
October 29, 2015 16:25
-
-
Save FilmKnurd/813bf8393a4a78e70e1f to your computer and use it in GitHub Desktop.
Revisions
-
Andrew Elster created this gist
Oct 29, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ var canvas = document.getElementById('canvas-id'); var context = canvas.getContext('2d'); var idoc = document.getElementById('iframe-id').contentWindow.document.body; domvas.toImage(idoc, function() { context.drawImage(this, 0, 0, width, height); // Download var rawImageData = canvas.toDataURL("image/png;base64"); rawImageData = rawImageData.replace("image/png", "image/octet-stream"); document.location.href = rawImageData; }, width, height);