Programming with LEADTOOLS Barcode

LEADTOOLS supports the reading and writing of three major types of barcodes using the Axtel engine. These types are:

image\sqrblit.gif Linear barcodes (1D)

image\sqrblit.gif PDF417 (2D)

image\sqrblit.gif 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

image\sqrblit.gif EAN 13

image\sqrblit.gif EAN 8

image\sqrblit.gif UPC A

image\sqrblit.gif Code 3 of 9

image\sqrblit.gif Code 128

image\sqrblit.gif Interleaved 2 of 5

image\sqrblit.gif CODABAR

image\sqrblit.gif UCCEAN 128

PDF Barcodes

image\sqrblit.gif PDF417

Data Matrix Barcodes

image\sqrblit.gif BARCODE_DM_DEF

image\sqrblit.gif BARCODE_DM_10x10

image\sqrblit.gif BARCODE_DM_12x12

image\sqrblit.gif BARCODE_DM_14x14

image\sqrblit.gif BARCODE_DM_16x16

image\sqrblit.gif BARCODE_DM_18x18

image\sqrblit.gif BARCODE_DM_20x20

image\sqrblit.gif BARCODE_DM_22x22

image\sqrblit.gif BARCODE_DM_24x24

image\sqrblit.gif BARCODE_DM_26x26

image\sqrblit.gif BARCODE_DM_32x32

image\sqrblit.gif BARCODE_DM_36x36

image\sqrblit.gif BARCODE_DM_40x40

image\sqrblit.gif BARCODE_DM_44x44

image\sqrblit.gif BARCODE_DM_48x48

image\sqrblit.gif BARCODE_DM_52x52

image\sqrblit.gif BARCODE_DM_64x64

image\sqrblit.gif BARCODE_DM_72x72

image\sqrblit.gif BARCODE_DM_80x80

image\sqrblit.gif BARCODE_DM_88x88

image\sqrblit.gif BARCODE_DM_96x96

image\sqrblit.gif BARCODE_DM_104x104

image\sqrblit.gif BARCODE_DM_120x120

image\sqrblit.gif BARCODE_DM_132x132

image\sqrblit.gif BARCODE_DM_144x144

image\sqrblit.gif BARCODE_DM_8x18

image\sqrblit.gif BARCODE_DM_8x32

image\sqrblit.gif BARCODE_DM_12x26

image\sqrblit.gif BARCODE_DM_12x36

image\sqrblit.gif BARCODE_DM_16x36

image\sqrblit.gif BARCODE_DM_16x48

image\sqrblit.gif 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.