Flexible Client-side QR Code Generator
AUTHOR: | nayuki |
---|---|
VIEWS TOTAL: | 2,189 views |
OFFICIAL PAGE: | Go to website |
LAST UPDATE: | November 5, 2018 |
LICENSE: | MIT |
Preview:
Description:
Just another flexible, customizable, client-side QR code generator built using pure JavaScript. Also supports Java, Python, and C++.
Main features:
- Error correction level: Low, Medium, Quartile and High
- Output format: bitmap or vector
- Custom scale and border
How to use it:
Import the QR Code Generator’s JavaScript file into the html page.
<script src="qrcodegen.js"></script>
Basic usages:
// Name abbreviated for the sake of these examples here var QRC = qrcodegen.QrCode; // Simple operation var qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM); var svg = qr0.toSvgString(4); // Manual operation var segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383"); var qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false);
Changelog:
11/05/2018
- Reordered calls to applyMask()/drawFormatBits() for conceptual clarity, without changing output (because masks don’t affect format bits), in all language versions.
11/02/2018
- Simplified a bit of code in JavaScript, TypeScript, Python.
10/29/2018
- Tweaked JavaScript code to use String.substring() instead of the deprecated non-standard substr().
10/27/2018
- Completely rewrote the algorithm for detecting finder-like patterns, making it more accurate and compliant with the QR Code specification, in all languages.
10/14/2018
- Tweaked QrCode.drawFormatBits() to use end-exclusive range in second copy for clarity, in most languages.
10/09/2018
- Simplified a bit of JavaScript and TypeScript code.
10/06/2018
- Renamed QrSegment.getBits() to getData() in {Java, JavaScript, TypeScript, Python} code, to match C++ and Rust.
10/04/2018
- Tweaked {JavaScript, TypeScript, HTML} code to encapsulate the application members.
10/02/2018
- Tweaked the BitBuffer class top-level comment in all languages except C.
- Tweaked BitBuffer.appendBits() comment in several language versions.
09/17/2018
- Swapped {dy,dx} variables in commutative operations for clarity, in all languages.
09/01/2018
- Reformatted some whitespace for alignment in all language versions.
08/28/2018
- Added an assertion to QrCode.encodeSegmentsAdvanced() in all language versions.