KA.Barcode Generator for .NET Suite
How to Generate QR Code Image in C# Projects
Complete C# source code to generate QR Code images in different image formats using Barcode for .NET
  • Easy integration into .NET framework for developers to generate, create QR Code images in C#.NET
  • Embedding dynamic linear & 2D barcodes, such as .NET EAN-8, VB.NET Intelligent Mail, UPC-A .NET WinForms, C# UPC-A, in your applications
  • Draw, print QR Code matrix barcodes in Windows applications, ASP.NET web pages, Crystal Reports, C# class library
  • Simple to generate and save 2D QR Code to local files in Png, Jpg, Gif, Tiff, Bmp image formats
  • Compatible with ISO/IEC 18004 QR Code bar code symbology specification to ensure valid image generation
  • Creating, generating Quick Response barcode with rotation in 0, 90, 180 or 270 degrees using C# programming
  • Adjust 2D QR Code image resolution through DPI setting to print high-quality images for all printers
  • Support to print 2D barcode in ASP.NET as well, including ASP.NET PDF417, EAN-13 .NET, ITF-14 .NET WinForms
  • Powerful barcoding functions including 40 QR Code versions for you to choose from
  • Mature QR Code barcode maker package for .NET developers
QR Code is a 2-dimensional barcode symbology also named Denso Barcode, QRCode, Quick Response Code, JIS X0510, ISO/IE18004. KA.Barcode Generator for .NET Suite is an easy-to-use .NET barcode maker component dll library. Besides this image setting tutorial, you can also view how to input valid data for QR Code and resize barcodes on the below C# examples.
How to Generate, Specify QR Code Barcode Images in C# Class

Install KA.Barcode Generator for .NET Suite into C#.NET Project

  1. 1.
  2. 2.
    Add Reference: Add "KeepAutomation.Barcode.Window.dll" to your C#.NET project reference.
  3. 3.
    Copy the following C#.NET Code onto your project to create, make a QR Code barcode image
using KeepAutomation.Barcode.Bean;

BarCode qrcode= new BarCode();
qrcode.Symbology = KeepAutomation.Barcode.Symbology.QRCode;
qrcode.CodeToEncode = "C#QRCode";
qrcode.X = 3;
qrcode.Y = 3;

QR Code X Dimension & Y Dimension

X dimension, the module bar width, is a primary parameter for barcode which stands for the width of the narrowest bar, while Y dimension is the height of the module bar. Since QR Code is made up tiny black module squares, you are supposed to set X and Y to the same value.
qrcode.X = 3;         
qrcode.Y = 3;

QR Code Barcode Margins / Quiet Zones

Margins are called quiet zones in the barcode specification. The ISO/IEC 16022 specification for QR Code requires margins on four sides of a QR Code image with four times the value of X dimension. For example, if you set X to 3 pixel, then you copy the demo code below:
qrcode.LeftMargin = 12;
qrcode.RightMargin = 12;
qrcode.TopMargin = 12;
qrcode.BottomMargin = 12;

QR Code Image Formats

KA.Barcode Generator for .NET Suite supports printing and saving QR Code barcodes in different image formats, including Png, Jpeg/Jpg, Gif, Tiff, Bmp, etc.
qrcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

QR Code Barcode Unit

KA.Barcode Generator for .NET Suite provides three units of measure for QR Code image generation: Pixel, Cm and Inch.
The default value is Pixel. Copy the demo code below to customize this parameter.
qrcode.BarcodeUnit = BarcodeUnit.Pixel;

QR Code Image Resolution

KA.Barcode Generator for .NET Suite is designed to help you print high-quality barcode images in C#.NET. You can customize image resolution through DPI, which is short for Dots per Inch. 72 DPI is the default value for the generated QR Code barcode images.
qrcode.DPI = 72; 

QR Code Image Orientation

In case you want to adjust QR Code orientation, i.e. the barcode rotation angle, KA.Barcode Generator for .NET Suite provides four types of barcode orientations for you to choose from: 0 degree, 90 degrees, 180 degrees, and 270 degrees.
qrcode.Orientation = KeepAutomation.Barcode.Orientation .Degree90

QR Code Version

KA.Barcode Generator for .NET Suite supports 40 types of QR Code versions, which vary from V1 to V40, with 21x21 modules to 177x177 modules, increasing in steps of four modules per side. Default value is V1. Copy the C# sample code below to adjust it.
qrcode.QRCodeVersion = QRCodeVersion.V2;

QR Code Error Correction Level (ECL)

As specified in the QR Code symbology standard, there are four levels of Reed-Solomon error correction, referred to as L, M, Q and H in increasing order of capacity, each allowing recovery of : L 7%, M 15%, Q 25%, H 30%. Default value is L. Copy the demo code below to adjust it.
qrcode.QRCodeECL = QRCodeECL.L;