-
-
Save zlumer/1b1e254fe6d8ecf243777debeeaaf8b9 to your computer and use it in GitHub Desktop.
Snippet to load html2canvas in the actual page
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
this.scriptObject=document.createElement('script'); | |
this.scriptObject.type='text/javascript'; | |
this.scriptObject.src='https://html2canvas.hertzen.com/dist/html2canvas.js'; | |
var ssc = document.getElementsByTagName('script')[0]; | |
ssc.parentNode.insertBefore(this.scriptObject, ssc); | |
function screenshot(elem) | |
{ | |
return html2canvas(elem, {logging: true, profile: true, useCORS: true }) | |
} | |
function appendScreenshot(elem) | |
{ | |
screenshot(elem).then(x => document.body.append(x)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment