jquery-qrcode icon indicating copy to clipboard operation
jquery-qrcode copied to clipboard

how to get toDataURL of generated qr

Open mikekay01 opened this issue 12 years ago • 4 comments

I want to use the generated QR code other places in my project. Is it possible to get the image from the canvas using toDataURL? I know generally how to use toDataURL, but the problem is the canvas generated in your script has no id so I don't know how to reference it...

mikekay01 avatar Apr 23 '13 13:04 mikekay01

Let me add a comment. I read previously that others were asking if you could write the qr code directly into an existing canvas. If that is possible it will fix my issue. I am basically trying to generate a qr code and place it into another canvas. the toDataURL is being used as an interim step to get an image.

mikekay01 avatar Apr 23 '13 14:04 mikekay01

Note in IE8 toDataURL() is not working

realuserofgit avatar Sep 17 '13 04:09 realuserofgit

I would also like to get this working

edoreld avatar Jan 17 '17 12:01 edoreld

can be done like this

var dataURL = $('canvas')[0].toDataURL("image/png"); console.log(dataURL);

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

ghostcs avatar Mar 06 '19 19:03 ghostcs