art-qr
v0.1.2
Published
JavaScript library to generate beautiful QR code in browser
Downloads
2
Readme
art-qr
Pure JavaScript library to generate beautiful QR code on websites
Installation
yarn add art-qr
/* or use npm if you prefer*/
npm install art-qr -S
Usgae
All options can see here.
Upon of the original version, we provide download
method, see the code as example:
import ArtQR from 'art-qr';
// create something you can access to store the instance if you want
let MyQRInstance;
const img = new Image();
img.crossOrigin = "Anonymous";
img.src = YOUR_IMAGE_URL;
img.onload = () => {
MyQRInstance = new ArtQR().create({
text: YOUR_URL_OR_TEXT,
size: 300,
margin: 10,
backgroundImage: img,
callback: function (dataUri) {
console.log(dataUri)
},
bindElement: 'qr' // id of <img /> in real dom
});
}
// download the QR code is easy
MyQRInstance.download()
Credit
The project is a fork of Awesome-qr.js, and changed the build process/code style for esay use.