C#. Data Matrix Generator Data Encoding Tutorial

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


 

C# Data Matrix Introduction

Data Matrix, also known as Data Matrix ECC200, is great 2-dimensional matrix barcode to store different data up to 2,335 alphanumeric characters.

C# Data Matrix barcode is a mature, easy-to-use .NET barcode component, written in Visual C#. It is easy to integrate barcode component into C#.NET development environments, and allows developers to quickly and easily add barcode generation and recognition functionality to .NET applications using C# class.

This document provides a complete C# source code for encoding Data Matrix barcode images in C# class using C# Barcode generation .net SDK.

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




How to generate, print barcode using .NET, Java sdk library control with example project source code free download:


Encode Data Matrix Valid Character in C#.NET

Data Matrix valid character set:

Standard ASCII Characters: 0-127

Extended ASCII Characters: 128-255

Encode ASCII Character into Data Matrix Using C#.NET class

ASCII Mode encodes 3 types characters: double digit numerics, ASCII value 0-127 and Extended ASCII value 128-255.

DataMatrix barcode = new DataMatrix();

barcode.Data = "!@#$%^&*():" <>"{}";

barcode.DataMode = DataMatrixDataMode.ASCII;

barcode.Format = ImageFormat.Png;

barcode.drawBarcode("c:/datamatrix.png");

Encode C40 Characters into Data Matrix Using C#.NET class

C40 Mode is designed to optimize the encoding of upper-case alphabetic and numeric characters.

DataMatrix barcode = new DataMatrix();

barcode.Data = "Data Matrix";

barcode.DataMode = DataMatrixDataMode.C40;

barcode.Format = ImageFormat.Png;

barcode.drawBarcode("c:/datamatrix.png");

Encode Text Characters into Data Matrix Using C#.NET class

Text Mode is designed to encode normal printed text, which are predominantly lowercase characters.

DataMatrix barcode = new DataMatrix();

barcode.Data = "OnBarcode";

barcode.DataMode = DataMatrixDataMode.Text;

barcode.Format = ImageFormat.Png;

barcode.drawBarcode("c:/datamatrix.png");

Encode X12 Characters into Data Matrix Using C#.NET class

It is used to encode the standard ANSI X12 electronic data interchange characters.

DataMatrix barcode = new DataMatrix();

barcode.Data = "ONBARCODE";

barcode.DataMode = DataMatrixDataMode.X12;

barcode.Format = ImageFormat.Png;

barcode.drawBarcode("c:/datamatrix.png");

Encode Edifact Characters into Data Matrix Using C#.NET class

It is used to encode 63 ASCII values (values from 32 to 94) plus an Unlatch character (binary 011111).

DataMatrix barcode = new DataMatrix();

barcode.Data = "035ONBARCODE";

barcode.DataMode = DataMatrixDataMode.Edifact;

barcode.Format = ImageFormat.Png;

barcode.drawBarcode("c:/datamatrix.png");

Encode Base256 Characters into Data Matrix Using C#.NET class

It is used to encode 8 bit values, all byte values 0-255 inclusive.

DataMatrix barcode = new DataMatrix();

barcode.Data = "onbarcode";

barcode.DataMode = DataMatrixDataMode.Base256;

barcode.Format = ImageFormat.Png;

barcode.drawBarcode("c:/datamatrix.png");

Modify Data Matrix Valid Length in C#.NET

Data Matrix is variable-length 2-dimensional barcodes. The storage capacity, see the table below:

Data Type Maximum Data Storage Capacity
Alphanumeric Data 2,335 characters
8-Bit Byte Character 1,555 characters
Numeric Data 3,116 characters


Data Matrix barcode length can be specified by encoding different length of data, for example:

barcode.Data = "12"; // in 2-digit length

barcode.Data = "DATA MATRIX"; // in 11-digit length

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









OnBarcode is a market-leading provider of barcode imaging 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 comprehensive tutorials and how-tos for various linear, 2d barcode information, such as C# in ASP.NET, C# .NET, C# Barcode Encoding, C# Barcode Image, VB.NET in ASP.NET, VB.NET Winforms, VB.NET Barcode Encoding, Paint QR Bar Code in Java, Print QR Code in Software. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide 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.