The reason that the html2canvas snapshot does not appear is explained by the following:
capturedCanvas.style.backgroundImage = 'url('+canvas.toDataURL();+')';
When you set such a background, you will only affect the canvas as a regular element, and not the contents of the canvas itself. It will not be registered as part of the pixels on it.
What you need to do is drawImage() result from html2canvas also on the final canvas (for example):
finalCanvasContext.drawImage(htmlCanvas, 0, 0); finalCanvasContext.drawImage(layer1canvas, 0, 0); finalCanvasContext.drawImage(layer2canvas, 0, 0);
or
$('.myClass').html2canvas({ onrendered: function( canvas ) { var capturedCanvas = document.getElementById('capturedImageView'); var ctx = capturedCanvas.getContext('2d'); ctx.drawImage(canvas, 0, 0);
(I do not know your other code, since you do not show it, so please adjust if necessary).
source share