WT: a QR Code encoding library
Just want to make a QR Code? Click here!
What is this?
WT is a JavaScript QR Code encoding library.
What is a QR Code?
A QR Code is a method of encoding data to be read by certain optical devices, devised by Denso WAVE. An example of a QR Code should be visible at the top of this page.
What makes WT different from other QR code encoding libraries?
WT is a native JavaScript library, not a port -- it was written from scratch with the help of the ISO QR Code standard, and the excellent materials provided by Carolyn Eby. If you're interested the internals of QR Codes, they're both excellent reads.
WT is also a low-level QR code library, for those who have somewhat of an understanding of how QR codes work and want more control. You can select your own error correction levels, include multiple data segments, even use some of the less-supported modes such as FNC1.
Also, unlike other, similar libraries, WT is released under the very permissive MIT license.
So what's the catch?
WT is a very new piece of software, and as such, probably has some bugs -- I've done by best to iron out the ones I could find, but as any programmer knows, any non-trivial program will have bugs. Please let me know if you find any.
WT also doesn't support all of the features in the ISO standard -- it lacks support for Kanji and Structured Append modes (Support for Kanji characters is still available through 8-bit mode with UTF-8 encoding).
What browsers does it work with?
- Google Chrome: WT was developed in the current version (36.0).
- Mozilla Firefox: WT was tested in the current version (31.0, Windows). Older versions were not tested, but most widely-used versions should be functional as well.
- Microsoft Internet Explorer: WT was tested in Internet Explorer versions 5 to 11 using the developer tools included in IE 11. It should be fully functional, with the exception that drawQRToCanvas() will not work in versions 8 and below (due to the lack of the canvas element).
- Google Chrome for Android: WT was tested in the current version (36.0).
- Opera: WT was tesetd in the current version (23.0).
Where can I get it?
You can take a peek into my repo on github, or you can download the minified current version.
How do I use it?
Ah, documentation. The spice of life. Here's a quick rundown of how to use WT:
Have a look at the current documentation.
Or, look at this brief example:
var qr = new QRCode();
qr.setVersion(0, QR__EC.M);
qr.setData([{ mode: QR__Mode.ECI, data: 26 }, { mode: QR__Mode.smart, data: 'Hello, world!'}]);
qr.drawSymbol();
drawQRToCanvas(qr, document.getElementById("MyCanvas"), 8);
If you'd like to see this code in action, look no further than the top of this page!