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>