Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing the contents of the canvas tag

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?

like image 418
Adrien Avatar asked Nov 27 '25 13:11

Adrien


1 Answers

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+'"/>');
like image 131
tnt-rox Avatar answered Nov 30 '25 04:11

tnt-rox



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!