Accusoft.BarcodeXpress7.Net Accusoft Pegasus
Create a 2D Barcode
See Also Send Feedback  
How To > Create a Barcode > Create a 2D Barcode

Glossary Item Box

Create a 2D Barcode

In order to read or write 2D barcodes, you must purchase either the 1D/2D Standard or 1D/2D Professional edition of Barcode Xpress.

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

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

Although Barcode Xpress 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 and sets the value of the barcode to be created.
    BarcodeData This property gets and sets the current barcode value as an array of bytes used only if non-ASCII text values are needed.
  3. Call either the 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
    Create This method is the main method for creating barcodes.
    CreateBitmap This method creates bitmap barcodes.
C# - Basic steps for writing PDF417 barcodes using Accusoft.BarcodeXpress.Net Copy Code
//create and unlock the BarcodeXpress component 
BarcodeXpress bcx = new BarcodeXpress();
bcx.Licensing.UnlockRuntime(12345, 12345, 12345, 12345);
//Create the writer PDF417 class
WriterPDF417 pdf417 = new WriterPDF417(bcx);
// Set the text value
pdf417.BarcodeValue = "PDF417 Value";
//call Create and get resulting image
imageXView1.Image = Accusoft.ImagXpressSdk.ImageX.FromHdib(imagXpress1, pdf417.Create());
// dispose of the writer PDF417 and barcode component
pdf417.Dispose();
bcx.Dispose(); 
C# - Basic steps for barcode writing DataMatrix Barcodes using Accusoft.BarcodeXpress.Net Copy Code
//create and unlock the BarcodeXpress component
BarcodeXpress bcx = new BarcodeXpress();
bcx.Licensing.UnlockRuntime(12345, 12345, 12345, 12345);
//Create the writer DataMatrix class
WriterDataMatrix dataMatrix = new WriterDataMatrix(bcx);
// Set the text value
dataMatrix.BarcodeValue = "DataMatrix Value";
//call Create and get resulting image
imageXView1.Image = Accusoft.ImagXpressSdk.ImageX.FromHdib(imagXpress1, dataMatrix.Create());
// dispose of the writer DataMatrix and barcode component
dataMatrix.Dispose();
bcx.Dispose(); 

 

See Also

©2011. All Rights Reserved.