jeromeetienne / jquery-qrcode

qrcode generation standalone (doesn't depend on external services)
http://blog.jetienne.com/blog/2011/04/07/jquery-qrcode/
MIT License
4.84k stars 2.5k forks source link

How to print it out through a browser? #81

Closed xiaoniao closed 8 years ago

xiaoniao commented 8 years ago

Two-dimensional code can be saved into a picture? Because the two-dimensional code display can not be printed out through the browser print function.

function print() { window.print(); }

jeromeetienne commented 8 years ago

you can render to canvas and use .toDataUrl()

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL