Print canvas contents

后端 未结 4 1978
粉色の甜心
粉色の甜心 2020-12-11 09:41
var print = document.createElement(\'button\');
var canvas = document.createElement(\'canvas\');
var ctx = canvas.getContext(\'2d\');

canvas.width = 300;
canvas.hei         


        
4条回答
  •  庸人自扰
    2020-12-11 10:06

    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.

提交回复
热议问题