Hire Me

C# Class for Generating QR Codes using the Google Charts API

In this tutorial I will share a class I have produced which wraps around the Google Charts API to generate a QR code in C#


QR codes are those nifty little barcode-type things you sometimes find on packaging which, when scanned with a smartphone, can perform an action such as taking you to a URL to view more detailed information.

Google provide a nice little API to make producing QR codes super simple. I've made it even simpler for C# programmers by wrapping the API in a C# Class which will allow you to specify any or all of their required and optional parameters, or simply the data you'd like to encode with default values for everything else.

No third party controls are required, although you'll obviously need Internet access so that the API can be called - I say API, it's simply a HTTP/GET request but you get the idea.

Live Coding Example

Basic Usage

string qrcode = new QRCodeHelper.GenerateUrl(DATA);

Output

A string URL which can be used as an img src tag in a HTML Page, or an object property in a WinForms application (such as PictureBox.ImageLocation).

Source Code

;

Have your say

Please consider what you post!
Chillax if you're angry.


Did you find this tutorial useful or informative?

Why not give me a call on 07990 523015 or contact me for a no-obligation chat about how I can help you with any software issues you're having - I have availability as of June 2017 and am available for both remote working and in-house projects subject to your location.