How to Create barcode images like QR Code in Web applications using C#?

21 Sep

QR Code is everywhere and since it could be scanned easily by iPhone, Blackberry, Windows phone and other smart phones, it gains popularity. 

It is easy to generate barcode images like QR Code or Code 39, Code 128 etc. in ASP.NET applications easily using C# class library. What you need is powerful tool which supports barcode generation in web applications. It should support QR Code barcode generation in web sites, web service and Microsoft IIS. Barcode images could be created in JPEG/JPG & TIFF, GIF, TIFF, BMP, PNG and and WBMP formats in the following projects:

  • ASP.NET Web Site (design-time and runtime support)
  • ASP.NET Web Service (runtime support)
  • Console Applications (runtime support)
  • Class Library (runtime support)

C# Code sample to generate qr code:

BarCode qrcode = new BarCode();
qrcode.Symbology = Aspper.Barcode.Symbology.QRCode;
qrcode.CodeToEncode = “QR4asp”;
qrcode.X = 4;
qrcode.Y = 4;
qrcode.BarcodeToImageFile(“C://qrcode-csharp.png”);

qrcode.ApplicationIndicator = 0;

qrcode.QRCodeECL = Aspper.Barcode.QRCodeECL.M;
qrcode.QRCodeECI = 3;
qrcode.QRCodeDataMode = Aspper.Barcode.QRCodeDataMode.Auto;
qrcode.QRCodeVersion = Aspper.Barcode.QRCodeVersion.V20;

Create QR Code Barcodes in C# Class library

  1. Start  Visual Studio ASP.NET web project in Visual C#.
  2. Browse for Aspper.aspnet.linearbarcode.dll. and add it as reference;
  3. Copy “linear.aspx” and “linear.aspx.cs”  to project folder where you needed;
  4. Now .NET programmers are able to write C# codes to generate QR Code barcode images in web applications.

Drag and drop barcode control: 

  1. Start your Visual Studio and open ASP.NET web project in Visual C#.
  2. Display the Toolbox and right click it, choose Choose Item and then select Browse to navigate to the Aspper.aspnet.linearbarcode.dll.
  3. Click OK and you could see Aspnet.Linear item on the toolbox palette.
  4. Drag and drop the barcode item to the aspx page.
  5. Activate the Property Window and change Barcode Type to QR Code, change other properties like height or width if necessary.

Details, please refer to http://www.aspper.com

Sybil

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: