Available in LEADTOOLS Barcode Modules. |
Programming with LEADTOOLS Barcode
LEADTOOLS supports reading and writing barcodes, finding duplicate barcodes, and obtaining barcode information read into barcode objects for major barcode types, including:
To add barcode functionality to your applications, you must first unlock the appropriate barcode module.
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.
LEADTOOLS provides a number of functions to let you work with duplicated barcodes. They let you:
Find the number of duplicates of a specific barcode
Determine whether a specific barcode is duplicated
Get the index of the first duplicated barcode
Get the index of a subsequent barcode
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::Write. To write linear, Data matrix, QR or PDF barcode symbols, use the LBarCode::Write function.
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.
LEADTOOLS Barcode Modules support reading and writing all barcode types to or from all image file types currently supported by LEADTOOLS.
For a table containing information for writing linear 1D barcodes, refer to: http://www.leadtools.com/SDK/Document/Document-Addon-Barcodelinear1D-chart.htm.
For a full list of supported file formats, refer to:
Summary of All Supported Image File Formats.
For more information, refer to:
Sample Programs