var print = document.createElement(\'button\'); var canvas = document.createElement(\'canvas\'); var ctx = canvas.getContext(\'2d\'); canvas.width = 300; canvas.hei
A better solution is to use the canvas.toDataURL() method and then set the resulting string to the src of an img. When doing this, generate the canvas through Javascript and never actually append it to the body of the page.