qr-image

QR Code generator (png, svg, pdf, eps)

qr-image

This is yet another QR Code generator.

Overview

  • No dependecies;
  • generate image in png, svg, epsand pdfformats;
  • numeric and alphanumeric modes;
  • support UTF-8.

Releases

Installing

npm install qr-image

Usage

Example:

var qr = require('qr-image');

var qr_svg = qr.image('I love QR!', { type: 'svg' });
qr_svg.pipe(require('fs').createWriteStream('i_love_qr.svg'));

var svg_string = qr.imageSync('I love QR!', { type: 'svg' });

More examples

qr = require('qr-image')

Methods

  • qr.image(text, [ec_level | options])— Readable stream with image data;
  • qr.imageSync(text, [ec_level | options])— string with image data. (Buffer for png);
  • qr.svgObject(text, [ec_level | options])— object with SVG path and size;
  • qr.matrix(text, [ec_level])— 2D array.

Options

  • text— text to encode;
  • ec_level— error correction level. One of L, M, Q, H. Default M.
  • options— image options object:
    • ec_level— default M.
    • type— image type. Possible values png(default), svg, pdfand eps.
    • size(png and svg only) — size of one module in pixels. Default 5for png and undefinedfor svg.
    • margin— white space around QR image in modules. Default 4for pngand 1for others.
    • customize(only png) — function to customize qr bitmap before encoding to PNG.
    • parse_url(experimental, default false) — try to optimize QR-code for URLs.

Changes

  • Use zlib.deflateSyncinstead of pako.
  • Fix deprecation warning for NodeJS 7.

TODO

  • Tests;
  • mixing modes;
  • Kanji (???).

HomePage

https://github.com/alexeyten/qr-image

Repository

https://github.com/alexeyten/qr-image.git


上一篇:nodes7
下一篇:languagedetect

相关推荐

官方社区

扫码加入 JavaScript 社区