Created
December 2, 2022 10:19
-
-
Save hubgit/b46300834903442ccf19272d1136eb13 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
[...document.querySelectorAll('div,main,body')].forEach(node => { | |
node.style.position = 'relative' | |
node.style.height = 'auto' | |
node.style.overflowY = 'visible' | |
}); | |
[...document.querySelectorAll('button')].forEach(node => { | |
node.remove() | |
}); | |
const { default: html2canvas } = await import('https://cdn.skypack.dev/html2canvas') | |
const canvas = await html2canvas(document.querySelector('main')) | |
const blob = await new Promise(resolve => canvas.toBlob(resolve, "image/png")) | |
const link = document.createElement('a') | |
link.target = '_blank' | |
link.href = URL.createObjectURL(blob) | |
link.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment