qrcode

QR code generator, supports Numeric, Alphanumeric and Binary input mode up to lvl 40.


Keywords
qr, qrcode
License
MIT
Install
bower install qrcode

Documentation

Build Status Coverage Status

qrcode.js v1.0.2

QR code generator, supports Numeric, Alphanumeric and Binary inputMode up to lvl 40.

Installation

Bower

We use bower for dependency management. Add

dependencies: {
    "qrcode": "latest"
}

To your bower.json file. Then run

bower install

Usage

Create QR code

var qr = new QRCode(typeNumber, correction, inputMode);
qr.addData(text);
qr.make();

Get module count

var modules = qr.getModuleCount();

Get tile color

for (var row = 0; row < modules; row++) {
  for (var col = 0; col < modules; col++) {
    var color = qr.isDark(row, col) ? '#000' : '#fff';
    //...
  }
}

type number

  • supported are all levels 1-40
  • use 0 for the lowest complexity

correction

  • Integer 1 - Level L (Low)
  • Integer 0 - Level M (Medium)
  • Integer 3 - Level Q (Quartile)
  • Integer 2 - Level H (High)

input mode

  • NUMBER: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • ALPHA_NUM: *0–9, A–Z (upper-case only), space, $, %, , +, -, ., /, :
  • 8bit (default): ISO 8859-1

Reference

Kazuhiko Arase, http://www.d-project.com/

License

The MIT License

Copyright (c) 2013 Jan Antala