Printing the contents of the canvas tag

£可爱£侵袭症+ 提交于 2019-12-12 15:04:45

问题


I make an application canvas. I load more image (png, gif) in canvas. When I click print on my browser (opera), the contents of the canvas tag does not print. With other browsers (FF, IE, Chrome), there is no problem. Why?


回答1:


this answer from Capture HTML Canvas as gif/jpg/png/pdf? might be useful.

var canvas = document.getElementById("mycanvas");
var img    = canvas.toDataURL("image/png");

with the value in IMG you can write it out as a new Image like so:

document.write('<img src="'+img+'"/>');


来源:https://stackoverflow.com/questions/8031016/printing-the-contents-of-the-canvas-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!