ImageGear .NET v25.1 - Updated
Create a 2D Barcode
User Guide > How to Work with... > Barcodes > Create a 2D Barcode

2D Barcodes

Each 2D barcode type supported by ImageGear has its own object type. ImageGear supports the creation of DataMatrix and PDF417 barcodes.

Object Description
WriterDataMatrix The class which can write out a DataMatrix barcode.
WriterPDF417 The class which can write out a PDF417 barcode.

Although the barcode engine supports reading of Aztec and QR Code, writing of these barcodes is not supported.

Basic Steps to Create a 2D Barcode

  1. Instantiate the writer class for the barcode type you want to create.
  2. Set the value you want to create.

Property Description
BarcodeValue This property gets or sets the value of the barcode to be created.
BarcodeValueAsByte This property gets or sets the current barcode value as an array of bytes used only if non-ASCII text values are needed.

  1. Call either the CreatePage method, Create method (to create an hDib) or the CreateBitmap method (to create a System.Drawing.Bitmap) from the instanced writer class. These methods will return an image with the desired barcode.

Method Description
CreatePage

This method is the main method for creating ImGearPage barcodes.

Examples for PDF417 Barcodes

 

C# Example - Basic steps for writing PDF417 barcodes
Copy Code
//create the Barcode component
ImageGear.Barcode.ImGearBarcode IGBarcodeWrite = new ImageGear.Barcode.ImGearBarcode();
//Create the writer PDF417 class
ImageGear.Barcode.ImGearWriterPDF417 pdfWriter = new ImageGear.Barcode.ImGearWriterPDF417(IGBarcodeWrite);
// Set the text value
pdfWriter.BarcodeValue = "PDF417 Value";
//call Create and get resulting image
myImGearPage = pdfWriter.CreatePage();
pdfWriter.Dispose();

VB.NET Example - Basic steps for writing PDF417 barcodes
Copy Code
'create the Barcode component
Dim IGBarcodeWrite As New ImageGear.Barcode.ImGearBarcode()
'Create the writer PDF417 class
Dim pdfWriter As New ImageGear.Barcode.ImGearWriterPDF417(IGBarcodeWrite)
' Set the text value
pdfWriter.BarcodeValue = "PDF417 Value"
'call Create and get resulting image
myImGearPage = pdfWriter.CreatePage()
pdfWriter.Dispose()

Examples for DataMatrix Barcodes

C# Example - Basic steps for barcode writing DataMatrix barcodes
Copy Code
//create the Barcode component
ImageGear.Barcode.ImGearBarcode IGBarcodeWrite = new ImageGear.Barcode.ImGearBarcode();
//Create the writer data matrix class
ImageGear.Barcode.ImGearWriterDataMatrix dmWriter = new ImageGear.Barcode.ImGearWriterDataMatrix(IGBarcodeWrite);
// Set the text value
dmWriter.BarcodeValue = "DataMatrix Value";
//call Create and get resulting image
myImGearPage = dmWriter.CreatePage();
dmWriter.Dispose();

 

VB.NET Example - Basic steps for barcode writing DataMatrix barcodes
Copy Code
'create the Barcode component
Dim IGBarcodeWrite As New ImageGear.Barcode.ImGearBarcode()
'Create the writer data matrix class
Dim dmWriter As New ImageGear.Barcode.ImGearWriterDataMatrix(IGBarcodeWrite)
' Set the text value
dmWriter.BarcodeValue = "DataMatrix Value"
'call Create and get resulting image
myImGearPage = dmWriter.CreatePage()
dmWriter.Dispose()