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 technology. 

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, it is possible to write transparent barcodes, but the transparent feature is not recommended.

LEADTOOLS provides a number of functions to let you work with duplicated barcodes. They let you:

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 linear, Data matrix, QR, PDF, Aztec, Maxi or MicroQR barcodes, a barcode object must be created and associated with a bitmap, as described above, before calling LBarCode::Write.

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 toolkits support reading and writing all barcode types to or from all image file types currently supported by LEADTOOLS.

For a table containing information useful when writing 1D barcode data, refer to Writing Linear 1D Barcodes.

For a table containing information useful when writing PDF barcode data, refer to PDF417 Barcodes in LEADTOOLS.

For a table containing information useful when writing QR barcode data, refer to QR Code Barcodes in LEADTOOLS.

For a full list of supported file formats, refer to:

Summary of All Supported Image File Formats

For more information, refer to:

Using the Barcode Demos


Demo Programs

Sample Programs

LEADTOOLS Barcode Support Forum

Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Barcode C++ Class Library Help