JSFiddle - React, Tailwind, and code Playground
by Léo Durand
HTML
<script src="https://rawgit.com/eKoopmans/html2canvas/develop/dist/html2canvas.min.js"></script>
<div id="element">
COVER TO CAPTURE
</div>
<div id="destination">
</div>
CSS
#element {
width: 200px;
height: 100px;
border: 1px solid black;
text-align: center;
}
#destination canvas {
display: block;
}
JavaScript
function myRenderFunction(canvas) {
destination.appendChild(canvas);
}
var element = document.getElementById('element');
var destination = document.getElementById('destination');
html2canvas(element, {
scale: 3,
onrendered: myRenderFunction
});