Skip to content
GBG Documents & Biometrics Documentation

CBarCode library

The CBarCode library functionality is similar to idData library. It extracts the data from 2D, PDF417 type bar code images. The library fetches the internal image (the last scanned image), processes its graphic information and activates its internal image analyzer. The resulting text is kept in internal data structure ready to be retrieved by the application.

Note: The library processes only the last image that was recently scanned. The library does not support external image file processing. For best results for 2D barcodes, we require a 600 dpi color image (RGB).

The following sections describe the CBarCode Library functions.

Initializes the CBarCode library

Note: This function must be called before calling any other function in the library.

Syntax

InitLibrary(License As String) As Long

Parameters

Parameter Description
[in] License Null-terminated string that contains the license key value

Return Values

Value Description
LICENSE_VALID License valid; library ready for use
LICENSE_INVALID License invalid; all scanner operations disabled
LICENSE_EXPIRED License expired; all scanner operations disabled
LICENSE_DOES_NOT_MATCH_LIBRARY License invalid for this library; all library operations disabled
GENERAL_ERR_PLUG_NOT_FOUND Returned if the attached scanner is not one of the following scanners: • ScanShell® 600 • ScanShell® 800 • ScanShell® 1000
SLIB_LIBRARY_ALREADY_INITIALIZED The InitLibrary function call is ignored because the library is already loaded.

Processes the internal image acquired in the last scan. The function deskews (straightens) and cleans the image and then passes it to the image analyzer for data extraction. The resultant textual data is kept in internal structure ready for retrieval by the RefreshData function. Processing the image does not modify the image content. Successful image processing depends on the following:

  • Bar code must be scanned at 600 dpi color image (RGB).
  • The image must be aligned in such way that the bar code image is vertical or horizontal with tolerance of no more than ±10 degrees.

Syntax

ProcImage(Reserved As String) As Long

Parameters

Parameter Description
[in] Reserved Reserved; null-terminated empty string

Return Values

Value Description
BC_ERR_NONE Function succeeded
LICENSE_INVALID License invalid; library not initialized with proper license
SLIB_ERR_SCANNER_NOT_FOUND No attached scanner found
SLIB_ERR_INVALID_SCANNER No scanner found attached to the PC
ID_ERR_STATE_NOT_SUPORTED Requested state ID not supported
INVALID_INTERNAL_IMAGE No internal image loaded; image must first be scanned
BC_ERR_NO_BC_FOUND No barcode pattern (PDF417) found on the image

Loads library properties with the recently detected data.

Note: This function is typically after executing the ProcImage function.

Syntax

RefreshData() As Long

Return Values

A non-zero value indicates that the data was successfully retrieved.

The AAMVA National standard defines 51-field types that might be encoded in the PDF417 barcode image. Each one of the fields may be retrieved from the image using the filed index specified in CBarCode library constants. If the field is populated, its value is retrieved and copied to value. If the field is empty (or not implemented on the image), the Value parameter is set to an empty string. The maximum field size may be up to 60 characters long.

Note that the fields are populated differently in different states. For example, the field NAME is populated in field index BCF_NAME for an Alabama driver license, and the same field is populated in field index BCF_DRIVER_LAST_NAME for a Delaware driver license. The raw field ranges from BCF_NAME (0) to BCF_AKA_PREFIX (50).

In addition to the raw fields, the CBarCode offers an additional set of fields (ranging from BCF_EMUL_FULL_NAME to BCF_EMUL_SSN). These fields are generated after the raw fields are loaded. The fields uniform the data extraction by copying the data from the raw fields and diverting it while considering its originated state type. This removes the burden from the developer of knowing the state type and the way the data is handled in this particular state.

Syntax

GetRawField(Index As Integer, Value As String) As Long

Parameters

Parameter Description
[in] Index An Integer that contains the value of the requested field
[out] Value A String that contains the returned value indicated by Index

Return Values

Value Description
BC_ERR_NONE Function succeeded
BC_ERR_BAD_PARAM Function failed; value passed by Index is not a valid field index

Returns the extracted text data in one bulk as detected by the bar code analyzer. The data is returned “as is” with no parsing or additional processing. This function is useful for retrieving data from general purpose bar code images.

Syntax

GetRawData(Buffer As String)

Parameters

Parameter Description
[out] Buffer A string that contains the returned value

Return Values

None

The CBarCode library stores the detected textual information in an internal data structure. This structure is refreshed in each RefreshData function call. All the properties are copied from the relevant raw fields and can be retrieved directly by using GetRawField function while passing the proper BFC_EMUL_XXX index. (Name, last name and name suffix). The supported properties are:

Name (as shown on card) NameFirst NameMiddle
NameLast NameSuffix DateOfBirth
License IssueDate ExperationDate
Address City State
Zip SSN