0

Specifications:

  • html2canvas v1.0.0-alpha.12 (available here)
  • Google Chrome 66.0.3359.181
  • Linux Mint 18.3 Sylvia

Issue:

Deepest apologies if this has already been answered—I'm a total novice with JS and online solutions for saving canvasses as images locally haven't quite seemed to work for me.

I have HTML featuring JS for randomization; each reload of the page can represent a "realization" of randomization. I'd like to generate n realizations of the HTML and save each as an image (with automatic sequential naming; e.g., if n=5000, img_0001.png, img_0002.png, ..., img_4999.png, img_5000.png).

Can anyone recommend a fix? So far, the only thing I've had success with has been to generate an on-screen .png with the below code (and then to "Save As ..." manually):

<script type="text/javascript" src="/home/baron1/Dropbox/github/html2canvas/dist/html2canvas.js"></script>
<script type="text/javascript">
        html2canvas(document.body).then(function(canvas) {
            document.body.appendChild(canvas);
        });
</script>
  • Reference [`html2canvas`](https://html2canvas.hertzen.com/dist/html2canvas.js) link. – Alex Jun 26 '18 at 14:48
  • Ah, thanks for pointing that out! – ironchefsakai Jun 26 '18 at 16:19
  • No problem, saves others time on searching for it. – Alex Jun 26 '18 at 16:20
  • Absolutely. I copy/pasted this from the `html2canvas` GitHub, which I decided wasn't the proper venue, but in my haste (and after many hours of travel between Tokyo and New York) I forgot to add in those particulars! Anyway, I very much appreciate the nudge! – ironchefsakai Jun 26 '18 at 18:45

0 Answers0