C# QR Code Generator Library
QR Code Image Generation Tutorial

Create QR Code Barcode on C# Images, TIFF, PDF, Word, Excel and PowerPoint

In this C# tutorial, you will learn how to create a QR Code 2d barcode image using C# in ASP.NET MVC Web, Windows applications.

  • Generate high quality QR Code barcode images
  • Advanced options for barcode size, barcode color, and QR Code data encoding
  • Generate GS1 compatible QR Code, and QR Code for international text
  • Draw, print QR Code in PNG, JPG, and Bitmap raster images
  • Create QR Code in PDF, TIFF, Office Word, Excel, PowerPoint files

How to create a QR Code in JPG, PDF, Tiff, Word, BMP file using C#

  1. Download XImage.Barcode Generator C# library
  2. Install C# library to draw QR Code barcodes
  3. Step by Step Tutorial

By using this .NET QR Code barcode generator add-on component, developers can create & draw scannable QR Codes on different image files (png, jpeg, gif and bmp) and insert them into common documents like TIFF, PDF, MS Word, Excel and PowerPoint using Visual C#.NET programming code. Following are some barcoding features offered by this .NET QR Code encoder DLL.

Related .net document control helps:
asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net pdf page: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net edit pdf text: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
asp.net edit pdf image: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...

  • Written in C# managed code, compatible with .NET Framework 2.0 and above
  • Generating, writing QR Code bar codes on PNG, JPG, GIF, and BMP image files with specified location
  • C# tutorial and sample codes to draw, insert QR Codes in PDF, TIFF, MS Word, Excel and PowerPoint
  • Control QR Code barcode size by setting size related properties
  • Use C# code to adjust bar code image format, location, resolution, orientation, version, color and more
  • Compatible with ISO+IEC+18004 QR Code bar code symbology specification

QR Code barcode data encoding in C#

Encode character set and QR Code data mode

QR Code support encoding the following characters.

  • Numeric data (digits 0 - 9)
  • Alphanumeric data (0 - 9; A -Z; nine other characters: space, $ % * + - . / : )
  • Byte data
  • Kanji characters

QR Code data mode

To encode the above character sets, QR Code defines five encoding data modes.

  • Auto
  • Numeric
  • AlphaNumeric
  • Byte
  • Kanji

QR Code maximum data length

Maximum characters per QR Code barcode with Version 40-L

  • numeric data: 7,089 characters
  • alphanumeric data: 4,296 characters
  • byte data: 2,953 characters
  • Kanji data: 1,817 characters

QR Code error correction mode

Four levels of Reed-Solomon error correction (referred to as L, M, Q and H in increasing order of capacity) allowing recovery of the QR Code barcode data.

Using XImage.Barcode Generator C# library, class QRCode has provided the property ECL. You can set one of the following values from RasterEdge.XImage.BarcodeCreator.QRCodeECL

  • L: 7% (QRCodeECL.H)
  • M: 15% (QRCodeECL.M)
  • Q: 25% (QRCodeECL.Q)
  • H: 30% (QRCodeECL.H)

QR Code Special Characters Encoding using C#

How to generate GS1 QR Code using C#

GS1 QR Code barcode is a standalone, two-dimensional matrix symbology that is made up of square modules arranged in an overall square pattern, including a unique finder pattern located at three corners of the barcode symbol.

To create valid GS1 QR Code using C# QR Code library, you need apply the following properties with valid value or formats.

  • FNC1: The value should be RasterEdge.XImage.BarcodeCreator.FNC1.FNC1_1ST_POS.
  • Data: Valid GS1 data message includes pairs of AI code and AI data. Using QR Code C# library, all AI codes should be surrounded by parentheses. For example: (11)010101(15)020202

How to encode Kanji characters in QR Code using C#

Apply the following settings to encode Kanji characters in QR Code C# barcode generator library:

  • ProcessTilde: Set to enable '~' in data message.
  • DataMode:It should be RasterEdge.XImage.BarcodeCreator.QRCodeDataMode.Kanji

How to encode international characters in QR Code using C#

To encode international characters in QR Code, you need convert internation text to byte array using UTF-8 encode, and generate QR Code using byte mode.

Following properties should be applied to generate international characters in QR Code using C#:

  • ProcessTilde: Set to enable '~' in data message.
  • DataMode:It should be RasterEdge.XImage.BarcodeCreator.QRCodeDataMode.Byte
  • Data: The international characters should be converted to byte array using UTF8 encoding.

            RasterEdge.XImage.BarcodeCreator.QRCode qrcode = new RasterEdge.XImage.BarcodeCreator.QRCode();

            string message = "สวัสดี";
            byte[] bytes = Encoding.UTF8.GetBytes(message);
            StringBuilder messageInBytes = new StringBuilder();
            foreach (byte b in bytes)
                messageInBytes.Append("~" + b.ToString().PadLeft(3, '0'));

            qrcode.Data = messageInBytes.ToString();
            qrcode.ProcessTilde = true;
            qrcode.DataMode = RasterEdge.XImage.BarcodeCreator.QRCodeDataMode.Byte;

            //  Set barcode size to 2 inch x 2 inch
            qrcode.AutoResize = true;
            qrcode.UOM = RasterEdge.XImage.BarcodeCreator.UnitOfMeasure.INCH;
            qrcode.BarcodeWidth = 2F;
            qrcode.BarcodeHeight = 2F;
            //  Set image resolution to 300 dpi.
            qrcode.Resolution = 300;

            //  Set all margins to 0
            qrcode.LeftMargin = 0;
            qrcode.RightMargin = 0;
            qrcode.TopMargin = 0;
            qrcode.BottomMargin = 0;

            Bitmap qrcodeBitmap = qrcode.ToImage();

How to create QR Code barcode in PDF file with web link added using C#.NET

We have provided complete C# source code to generate QR Code barcodes in PDF, Tiff, MS Office Word/Excel/PowerPoint and image files.