I'm currently looking for a js library that can encode text in qr codes. The only one I've been able to find so far seems broken, although other people claim to be using it. The sample page doesn't work. By playing a bit with it I managed to generate codes but they don't get decoded by the phone software.
Is there another library is js for this? Has anyone managed to get it to work?
I'm not interested in a solution that pulls the code from an online service (kaywa, google etc.).
Update:
Well, you guys are right, that library does work. My problem was that I tried including it in a HTML5 Boilerplate page, and document.write doesn't seem to work in that. I modified the sample code anyway to make the browser draw in a canvas not a table and I got the order of the fillRect function backwards. Below is the corrected function call.
context.fillRect(c * UNIT_SIZE, r * UNIT_SIZE, UNIT_SIZE, UNIT_SIZE); // it's column-row, not row-column; don't ask why :)
Since I don't get my image transposed anymore :), now the qr decodes fine. Thanks for the support.
Inside this function, we are going to use a javascript library qrcode. js to generate QR code. You can use this library via a CDN by including the below <script> tag in the <head> tag of html . Inside the generate() function, we will create a new object using the given library.
Free for commercial usageAll generated QR Codes are 100% free and can be used for whatever you want. This includes all commercial purposes.
A QR code data size limit is 7,089 numeric characters, but for a data matrix, it is only 3,116 characters. When talking about alphanumeric characters, the data matrix trails behind 2,335 characters with no support for other types of language.
I wrote a simple GPLv3 qr encoder in javascript that is local, uses HTML5 and is really fast as it is a port of an embedded C version I wrote for Atmel AVR processors.
http://code.google.com/p/jsqrencode/downloads/list
There is a live version (which is saveable as a webapp on iOS devices) at http://zdez.org/qrenc3.html (save to home, opens in safari so you can copy the image or use airprint)
Here is the link to the downloadable source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With