C# Barcode Data Encoding Tutorial
How to encode Unicode & GS1 barcode images using Visual C# class
Create GS1 compatible barcodes and encode Unicode into barcodes for C#.NET programs
In this C# tutorial, you will learn how to generate linear and matrix barcodes with various data encoding formats in your C# ASP.NET and Windows apps.
- Barcode with GS1 data
- Barcode encoding Unicode data message
- Generate barcodes from valid numbers, or string text
How to create barcode with valid data formats using C#
- Simple to use .NET barcode generator dll components for C# barcode generating & encoding
- Enable C# developers to generate & make barcodes in Windows Forms,
ASP.NET, .NET Reporting and Console projects
- Use free Visual C# sample code to generate high print-quality GS1 compatible 1d & 2d barcodes
- Support encoding Unicode into C#.NET barcode images, like QR Code and
Data Matrix
- Provide several developer licenses & packages, with the option to get C#.NET Source Code
- C# demo code available to assign bar code pictures in C#.NET
- Mature C# barcode device with user-friendly interface for barcode designer
- Advanced Barcode Control SDKs for .NET, C#.NET, ASP.NET website, Visual Basic program
OnBarcode.com develops comprehensive
Barcode Library SDK for .NET, C#, VB.NET & ASP.NET barcode creating applications. .NET developers can easily generate readable barcode images in various .NET framework projects, like C#.NET Windows Forms, ASP.NET C# Web Service, C#.NET Crystal Reports and RDLC Reports applications. More than twenty linear & 2d barcodes are supported by this mature C#.NET barcode generator tool.
If you are looking for complete guides to create barcodes in C# server side or in WinForms, navigate to pages below:
- Tutorial for C# Barcode Generation - Generating batch barcode (linear & bidimensional) images in .NET projects using C#
- Tutorial for C# Barcode ASP.NET Generation - Streaming & creating barcodes in ASP.NET web applications (html) in C#
- Tutorial for C# Barcode WinForms Generation - Downloading barcode dll to encrypt barcode graphics in Windows Forms using C#
- Tutorial for C# Barcode Imaging Setting - Creating & printing barcodes and adjust image settings in Visual Studio using C#
How to Encode GS1 Barcode Using Visual C#
Top
C# Barcode Library supports encoding these GS1 compatible barcode images: GS1 DataBar, EAN-128/GS1-128, ITF-14, Data Matrix, and QR Code. Add barcode dll to reference first, and see GS1 encoding examples of these barcodes as follows. FYI, select your barcode according to the encoding C# barcode text string (alphanumeric characters or numeric data from database).
Besides data encoding settings, C# Barcode Dll also provides designing functions to customize barcode symbology, such as automatically adding checksum, adjusting barcode length & height, display barcode formats (jpeg, gif, png, tiff, bitmap), manage resolution /color or image export. Just add the dll to reference and copy the C# code step by step.
Generate GS1 DataBar Barcode in C# Class
Linear gs1_databar = new Linear();
gs1_databar.Type = BarcodeType.RSS14;
gs1_databar.Data = "01666663333300";
// GS1 DataBar Size Settings
gs1_databar.UOM = UnitOfMeasure.PIXEL;
gs1_databar.X = 2;
gs1_databar.Y = 82;
gs1_databar.LeftMargin = 20;
gs1_databar.RightMargin = 20;
// GS1 DataBar Image Format Setting
gs1_databar.Format = System.Drawing.Imaging.ImageFormat.Gif;
// Save GS1 DataBar to C:\
gs1_databar.drawBarcode("C://csharp_gs1_databar.gif");
Generate GS1-128/EAN-128 Barcode in C# Class
Linear gs1_128 = new Linear();
gs1_128.Type = BarcodeType.EAN128;
gs1_128.Data = "(8101)06789900799";
// GS1-128/EAN-128 Size Settings
gs1_128.UOM = UnitOfMeasure.PIXEL;
gs1_128.X = 1;
gs1_128.Y = 80;
gs1_128.LeftMargin = 10;
gs1_128.RightMargin = 10;
// GS1-128/EAN-128 Image Format Setting
gs1_128.Format = System.Drawing.Imaging.ImageFormat.Png;
// Save GS1-128/EAN-128 to C:\
gs1_128.drawBarcode("C://csharp_gs1_128.png");
Generate GS1 Compatible ITF-14 Barcode in C# Class
Linear itf_14 = new Linear();
itf_14.Type = BarcodeType.ITF14;
itf_14.Data = "1061414199993";
// ITF-14 Size Settings
itf_14.UOM = UnitOfMeasure.PIXEL;
itf_14.X = 1;
itf_14.Y = 76;
itf_14.N = 2.0f;
// ITF-14 Bearer Bar Settings
itf_14.BearerBarHori = 2;
itf_14.BearerBarVert = 2;
// ITF-14 Image Format Setting
itf_14.Format = System.Drawing.Imaging.ImageFormat.Png;
// Save ITF-14 to C:\
itf_14.drawBarcode("C://csharp_itf_14.png");
Generate Compatible Data Matrix Barcode in C# Class
DataMatrix data_matrix = new DataMatrix();
// Set Data Matrix barcode data to encode
data_matrix.Data = "(8101)06789900799";
// Set Data Matrix data mode
data_matrix.DataMode = DataMatrixDataMode.ASCII;
// Data Matrix format mode
data_matrix.FormatMode = DataMatrixFormatMode.Format_16X16;
// Set Data Matrix to be GS1 Compatible
data_matrix.FNC1 = FNC1.FNC1_1ST_POS;
// Set Data Matrix barcode size;
data_matrix.UOM = UnitOfMeasure.PIXEL;
data_matrix.X = 4;
data_matrix.LeftMargin = 8;
data_matrix.RightMargin = 8;
data_matrix.TopMargin = 8;
data_matrix.BottomMargin = 8;
// Generate Data Matrix and encode it to gif format
data_matrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;
data_matrix.drawBarcode("C:\\csharp_data_matrix.gif");
Generate Compatible QR Code Barcode in C# Class
QRCode qr_code = new QRCode();
// Set QR Code barcode data
qr_code.Data = "(8101)06789900799";
// Set QR Code data mode
qr_code.DataMode = QRCodeDataMode.Auto;
// Set QR Code to be GS1 Compatible
qr_code.FNC1 = FNC1.FNC1_1ST_POS;
// Set QR Code barcode size;
qr_code.UOM = UnitOfMeasure.PIXEL;
qr_code.X = 4;
qr_code.LeftMargin = 16;
qr_code.RightMargin = 16;
qr_code.TopMargin = 16;
qr_code.BottomMargin = 16;
// Save created QR Code to png file format
qr_code.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
qr_code.drawBarcode("C:\\csharp_qr_code.png");
How to Encode Unicode into Barcode Using Visual C#
Top
Instead of encoding ISO 8859-1 standard chars, you may need to encode other encoding characters, such as Arabic, Cyrillic, Greek, Hebrew. And our C# Barcode Generator for .NET supports encoding these special characters through Unicode encoding. The following are examples for encoding Unicode into QR Code, Data Matrix and PDF417.
Please note that, the following C# code uses Base64[] conversion method to encode Unicode. Therefore, to scan and obtain original data, you need to convert the decoded data back to original data via Base64[] conversion. Besides, random watermark may appear in barcode image for evaluation.
Encode Unicode into QR Code Barcode Using C#
Encode Unicode into Data Matrix Barcode Using C#
Encode Unicode into PDF417 Barcode Using C#
C# Barcode Generation Guide for Linear & 2D Barcode Types
Top
.NET Barcode Component for C# - Barcodes Generation