art-qr

0.1.2 • Public • Published

art-qr

Pure JavaScript library to generate beautiful QR code on websites

travis code style: prettier npm version

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.

Readme

Keywords

none

Package Sidebar

Install

npm i art-qr

Weekly Downloads

5

Version

0.1.2

License

none

Last publish

Collaborators

  • liu9293