Skip to content

Instantly share code, notes, and snippets.

@jonz94
Created February 24, 2020 12:45
Show Gist options
  • Select an option

  • Save jonz94/82a5158cd163fbac4da74e4fca15f0ad to your computer and use it in GitHub Desktop.

Select an option

Save jonz94/82a5158cd163fbac4da74e4fca15f0ad to your computer and use it in GitHub Desktop.
  1. Open html file with broswer

  2. Open console, paste following code snippet

let base64png;

fetch('https://html2canvas.hertzen.com/dist/html2canvas.min.js')
  .then(response => response.text())
  .then(text => eval(text))
  .then(() => html2canvas(document.body))
  .then(canvas => (base64png = canvas.toDataURL()))
  .then(() => console.log('finish!'))
  .catch(error => console.log('failed, error detail: ', error));
  1. Copy value of base64png into clipboard by typing:
copy(base64png);
  1. Go to https://onlinepngtools.com/convert-base64-to-png, paste the value of base64png, and download png file 🎉
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment