Skip to content Skip to sidebar Skip to footer

Can You Clone Contents Of An Element Into Canvas?

I was wondering if it's possible to clone an HTML element into canvas. So looking at this JSFiddle, how would you duplicate it into canvas? I've seen ways to draw DOM objects into

Solution 1:

You can use html2canvas to do it, you can checkout the demo at this JSFiddle.

html2canvas(document.getElementById('clone-me'), {
    onrendered: function(canvas) {
        var canvas1 = document.getElementById('canvas1');
        var ctx = canvas1.getContext('2d');
        ctx.drawImage(canvas, 0, 0);
    }
});

Post a Comment for "Can You Clone Contents Of An Element Into Canvas?"