Programming with LEADTOOLS Barcode
LEADTOOLS supports the reading and writing of three major types of barcodes using the Axtel engine. These types are:
 Linear barcodes (1D)
 Linear barcodes (1D)
 PDF417 (2D)
 PDF417 (2D)
 Data Matrix (2D)
 Data Matrix (2D)
For each major type of barcode, one or more subtypes are supported for both reading and writing. These subtypes are:
Linear Barcodes
 EAN 13
 EAN 13
 EAN 8
 EAN 8
 UPC A
 UPC A
 Code 3 of 9
 Code 3 of 9
 Code 128
 Code 128
 Interleaved 2 of 5
 Interleaved 2 of 5
 CODABAR
 CODABAR
 UCCEAN 128
 UCCEAN 128
PDF Barcodes
 PDF417
 PDF417
Data Matrix Barcodes
 BARCODE_DM_DEF
 BARCODE_DM_DEF
 BARCODE_DM_10x10
 BARCODE_DM_10x10
 BARCODE_DM_12x12
 BARCODE_DM_12x12
 BARCODE_DM_14x14
 BARCODE_DM_14x14
 BARCODE_DM_16x16
 BARCODE_DM_16x16
 BARCODE_DM_18x18
 BARCODE_DM_18x18
 BARCODE_DM_20x20
 BARCODE_DM_20x20
 BARCODE_DM_22x22
 BARCODE_DM_22x22
 BARCODE_DM_24x24
 BARCODE_DM_24x24
 BARCODE_DM_26x26
 BARCODE_DM_26x26
 BARCODE_DM_32x32
 BARCODE_DM_32x32
 BARCODE_DM_36x36
 BARCODE_DM_36x36
 BARCODE_DM_40x40
 BARCODE_DM_40x40
 BARCODE_DM_44x44
 BARCODE_DM_44x44
 BARCODE_DM_48x48
 BARCODE_DM_48x48
 BARCODE_DM_52x52
 BARCODE_DM_52x52
 BARCODE_DM_64x64
 BARCODE_DM_64x64
 BARCODE_DM_72x72
 BARCODE_DM_72x72
 BARCODE_DM_80x80
 BARCODE_DM_80x80
 BARCODE_DM_88x88
 BARCODE_DM_88x88
 BARCODE_DM_96x96
 BARCODE_DM_96x96
 BARCODE_DM_104x104
 BARCODE_DM_104x104
 BARCODE_DM_120x120
 BARCODE_DM_120x120
 BARCODE_DM_132x132
 BARCODE_DM_132x132
 BARCODE_DM_144x144
 BARCODE_DM_144x144
 BARCODE_DM_8x18
 BARCODE_DM_8x18
 BARCODE_DM_8x32
 BARCODE_DM_8x32
 BARCODE_DM_12x26
 BARCODE_DM_12x26
 BARCODE_DM_12x36
 BARCODE_DM_12x36
 BARCODE_DM_16x36
 BARCODE_DM_16x36
 BARCODE_DM_16x48
 BARCODE_DM_16x48
 BARCODE_DM_WRITE_RECTANGLE
 BARCODE_DM_WRITE_RECTANGLE
LEADTOOLS provides functions for reading and writing barcodes, finding duplicate barcodes and obtaining barcode information read into a barcode object. LEADTOOLS supports the reading and writing of the above barcode types for all bitmaps currently supported by LEADTOOLS. For a full list of supported file formats, refer to Summary of All Supported Image File Formats .
An LBarCode object is created using the LBarCode::LBarCode() constructor. Once created, the LBarCode object must be associated with a valid bitmap in order to read or write barcodes. A bitmap may be associated with an LBarCode object using the LBarCode::SetBitmap function. A bitmap can also be associated with an LBarCode object if the barcode object was created using the LBarCode::LBarCode(pLBitmap) constructor. To determine whether a barcode object is associated with a bitmap, and therefore valid, call LBarCode::IsValid.
Once an LBarCode object is valid, barcodes can be read or written. Before reading barcodes, the barcode read options must be set. These barcode read options determine the type of barcodes to read and the behavior of the search process. To determine the current barcode read options, call LBarCode::GetReadOptions. For more information on the barcode read options, refer to the BARCODEREADOPT structure. After the read options have been set, barcode data can be read using LBarCode::Read. This function allocates memory for a barcode data array that will contain the barcode data that is read. This barcode data can be accessed using the LBarCode::GetBarCodeDataItem function.
You can read/write barcodes by specifying a color for bars and space. Also, you can write transparent barcodes, but the transparent feature isn't recommended.
Once the barcode data has been read, the LBarCode::IsDuplicated function can be used to determine whether a specific barcode in the array is duplicated within the array. If LBarCode::IsDuplicated returns TRUE, the specified barcode is duplicated within the array. The number of duplicates within the array can be found by calling LBarCode::GetDuplicatedCount. The index(es) of the duplicated barcodes can be found using the LBarCode::GetFirstDuplicated and LBarCode::GetNextDuplicated functions.
To write barcodes, a barcode object must be created and associated with a bitmap, as described above, before calling LBarCode::WriteExt or LBarCode::WriteExt2. To write linear, Data matrix or PDF barcode symbols, use the LBarCode::WriteExt function. To write these barcode symbols and QR barcode symbols, use LBarCode::WriteExt2.
To get barcode version information, call LBarCode::BarVersionInfo.
When the barcode data is no longer needed, the memory allocated for it can be freed by calling LBarCode::Free. This function is also called by LBarCode::~LBarCode when the LBarCode class object is destroyed, or when a subsequent call to LBarCode::Read is made.