ImageGear for .NET User Guide > Using ImageGear for .NET > Using ImageGear.Barcode Namespace > How to 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
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. |
Method | Description |
CreatePage |
This method is the main method for creating ImGearPage 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() |
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() |