Saturday, October 15, 2011

Generating QR code by Google Chart API

Google provide lots of API for developers to develop their own tools. Today I would like to go through a funny feature from Google Chart Tools - QR code generating.

Developer always have to come across with tons of data and make it to a presentable report for end-users. Google Chart Tools can save your a day. However, we just focus on QR code generating function today. If you interest in it, check it out at

Generating QR code by Google API is just a piece of cake. You just have to append your target message to a URL. Here is an example.

I want to make a QR code with a message 'We love programming.', here we go

Actually it will be a image if you click on it. The parameter chs is widthxheight. Parameter chl is the message or URL you want to include. Please do URL encode for your message.

I have written a snippet of code to generate QR code by current URL automatically.

<div id="qrcode"></div>
var img = document.createElement('img');
img.src = '' + encodeURIComponent(document.location.href);

Here is just the core function. You can also design your own interface to make a nice QR code generator. For more details, check out the document of Google,

You can build QR code easily with Google Chart API now, but how QR code can help on your business? Try to read this:
Related Posts Plugin for WordPress, Blogger...