How to display or generate DataMatrix 2D barcode using Bytescout BarCode SDK for .NET - ByteScout

How to display or generate DataMatrix 2D barcode using Bytescout BarCode SDK for .NET

  • Home
  • /
  • Articles
  • /
  • How to display or generate DataMatrix 2D barcode using Bytescout BarCode SDK for .NET

Output barcode screenshot (DataMatrix 2D symbology barcode type):

DataMatrix barcode sample

Data Matrix symbology. The most popular application for Data Matrix is marking small items. The Data Matrix can encode text and raw data. Usual data size is from a few bytes up to 2 kilobytes.

Bytescout BarCode SDK supports ECC 200 error correction for DataMatrix barcodes.

Important: you can also use BarCode Windows Forms or Web ImageControl instead. To use the Windows Formscontrol in Visual Studio please open Toolbox and open “Bytescout Software” tab and drag-n-drop “BarCode” control into your WinForms or ASP.NET application (in design mode)

Visual Basic:

Imports Bytescout.BarCode

Module Module1

Sub Main()
‘ Create new barcode
Dim barcode As New Barcode()

‘ Set symbology
barcode.Symbology = SymbologyType.DataMatrix

‘ Set value
barcode.Value = “this is a test string”

‘ Save barcode to image
barcode.SaveImage(“result.png”)

‘ Show image in default image viewer
Process.Start(“result.png”)
End Sub

End Module

Visual C#:

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

using Bytescout.BarCode;

namespace Sample
{
class Program
{
static void Main(string[] args)
{
// Create new barcode
Barcode barcode = new Barcode();

// Set symbology
barcode.Symbology = SymbologyType.DataMatrix;

// Set value
barcode.Value = “this is a test string”;

// Save barcode to image
barcode.SaveImage(“result.png”);

// Show image in default image viewer
Process.Start(“result.png”);
}
}
}

Tutorials:

prev
next