mndyg / qrcanvas

Generate characteristic qrcodes with a canvas.

Home Page:https://gera2ld.github.io/qrcanvas/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QRCanvas

NPM License Downloads

This is a QRCode generator written in pure javascript.

Based on Kazuhiko Arase's QRCode.

The only requirement is that the browser works with a canvas, which is supported by most modern browsers.

Installation

$ npm i qrcanvas

Quick Start

  • Use in browser

    <div id="qrcode"></div>
    
    <script src="lib/qrcanvas.js"></script>
    
    <!-- You can use a slim version if no effects are wanted. -->
    <script src="lib/qrcanvas.slim.js"></script>
    var canvas = qrcanvas({
      data: 'hello, world'
    });
    document.getElementById('qrcode').appendChild(canvas);
  • Use in Node.js

    node-canvas is required in Node.js.

    const fs = require('fs');
    const qrcanvas = require('qrcanvas');
    const canvas = qrcanvas({
      data: 'hello, world'
    });
    // canvas is an instance of `node-canvas`
    canvas.pngStream().pipe(fs.createWriteStream('qrcode.png'));

More

Snapshots

1

2

About

Generate characteristic qrcodes with a canvas.

https://gera2ld.github.io/qrcanvas/


Languages

Language:JavaScript 91.6%Language:HTML 7.1%Language:CSS 1.0%Language:Shell 0.4%