Created
December 25, 2019 06:39
-
-
Save jami-i/7b05d7296e559a7186628de09c390c10 to your computer and use it in GitHub Desktop.
This file contains 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
let s = document.createElement("script"); | |
s.src = "https://html2canvas.hertzen.com/dist/html2canvas.js"; | |
document.body.append(s); |
This file contains 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
let s2 = document.createElement("script"); | |
s2.src = "https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"; | |
document.body.append(s2); |
This file contains 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
html2canvas(document.body, {allowTaint: true, useCORS: true}) | |
.then(function(canvas) { | |
canvas.toBlob(function(blob){ saveAs(blob,"image.png"); }); | |
}) | |
.catch(function(e){ console.error(e)}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment