C#. QR Code Generator Data Encoding Tutorial

sample source code to input valid data and generate 2D QR Code images in C# .NET


C# QR Code Introduction

QR Code, also known as Denso Barcode, QRCode, Quick Response Code, is a kind of 2D (two dimensional) barcode widely used today.

C# QR Code barcode is .NET barcode generating SDK, which is a user-friendly, light weight barcode component for making QR Code barcodes in C#.NET Winforms application, C#.NET ASP.NET Web forms applications, C#.NET class and console applications. This document provides 100% C# source code to explain how to encode QR Code valid data with .NET Barcode suite using C# class.

OnBarcode C# Barcode Generator is designed to generate, create QR Code and other linear & 2d barcodes in Microsoft Word. Here are some more tutorials for C# QR Code generation concerning size & image setting.

Encode QR Code Valid Character in C#.NET

QR Code valid character set:

Numeric data

Alphanumeric data

Byte characters

Kanji characters

Encode Alphanumeric Character into QR Code Using C#.NET class

It allows encoding alphanumeric data, including digits 0 - 9; upper case letters A -Z; and nine other characters: space, $ % * + - . / : .

QRCode barcode = new QRCode();

barcode.Data = "OnBarcode";

barcode.DataMode = QRCodeDataMode.Alphanumeic;

barcode.Format = ImageFormat.Png;


Encode Numeric into QR Code Using C#.NET class

It allows encoding numeric data (digits 0 - 9).

QRCode barcode = new QRCode();

barcode.Data = "123456789";

barcode.DataMode = QRCodeDataMode.Numeric;

barcode.Format = ImageFormat.Png;


Encode Byte Characters into QR Code Using C#.NET class

It allows encoding byte data (default: ISO/IEC 8859-1).

QRCode barcode = new QRCode();

barcode.Data = "$ % * + - . / ";

barcode.DataMode = QRCodeDataMode.Byte;

barcode.Format = ImageFormat.Png;


Encode Kanji Characters into QR Code Using C#.NET class

It allows encoding Kanji characters. Please see SJIS (Shift JIS encoding): from ~9ddddd (Shift JIS 0x8140 ~ 0x9FFC and 0xE040 ~ 0xEBBF)

QRCode barcode = new QRCode();

barcode.Data = "~937727";

barcode.ProcessTild = True;

barcode.DataMode = QRCodeDataMode.Kanji;

barcode.Format = ImageFormat.Png;


Modify QR Code Valid Length in C#.NET

QR Code is variable-length 2-dimensional barcodes, the storage capacity see the table below:

Data Type Maximum Data Storage Capacity
Alphanumeric Data 4,296 characters
Numeric Data 7,089 characters
Byte Character 2,953 characters
Kanji Character 1,817 characters

The length of QR Code is determined by the length of encoding data, for example:

barcode.Data = "1"; // in 1-digit length

barcode.Data = "123456789"; // in 9-digit length

barcode.Data = "12345678901234567890"; // in 20-digit length

OnBarcode is a market-leading provider of barcode generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides high quality tutorials and guides for various linear, 2d barcode information, such as C# Barcode, QR Code C#, QR Code VB.NET, QR Code ASP.NET, QR Code .NET, ASP.NET Barcode. OnBarcode barcode products are supported by RasterEdge .NET HTML5 Document Viewer high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.