Sunday, 1 February 2015

QR Code Generator



What is QRCode:

QR code (abbreviated from Quick Response Code)is the trademark for a type of matrix bar code first is designed in Japan.


Nowadays, QR Code is mostly Used in Mobile phones to ease data entry.

Generation of  QR Code:

Nowadays, QR Code is mostly Used in Mobile phones to ease data entry.

QRCode Library provides Encode content into a QR Code image which can saved in JPEG, GIF, PNG OR BITMAP Formats

Install QRCode Library, run the following Command in the package Manager Console.
 


 Open package Manager Console from Library Packager Manager.









































 Added MessageToolkit

























Add the following to the default.aspx

<div>
      <asp:Image ID="imgQRCode" runat="server"/>
</div>



Now add the code in the Code behind.
add the namespaces as follows.


using System.Drawing;
using System.Drawing.Imaging;
using MessagingToolkit.QRCode.Codec.Data;
using MessagingToolkit.QRCode.Codec;


Add the QRCode generator in the Button click or based on your requirement.


QRCodeEncoder encoderObj = new QRCodeEncoder();
Bitmap bitImg = encoderObj.Encode("http://journeytodotnetauthority.blogspot.in/");
bitImg.Save(Server.MapPath("~/images/dotnetauthority.jpg"), ImageFormat.Jpeg);
imgQRCode.ImageUrl = "~/images/dotnetauthority.jpg";

The output as follows.
 























Read the QRCode from mobile














No comments:

Post a Comment