Skip to content
GBG Documents & Biometrics Documentation

CPassport library

The CPassport library extends the function set introduced in the CPassport library of the ScanW wrapper library. The library exports additional methods to control the scanner functionality. These methods include:

Extracts the face image from an existing passport image. The source image must be 3”x 5”, 300 DPI, true color (24- bit).

Syntax

GetFaceEx (sourceFile As String, destFile As String) As Long

Parameters

Parameter Description
sourceFile Full file name of the passport source file (including path)
destFile Full file name of the face destination file (including path)

Return Values

Value Description
PASS_ERR_NONE Face image extracted successfully.
PASS_ERR_CANNOT_DELETE_ DESTINATION_IMAGE Can’t create file; a read-only file with that name already exists
PASS_ERR_CANNOT_COPY_ TO_DESTINATION Failed to copy the face image to the destination drive
PASS_ERR_FACE_IMAGE_ NOT_FOUND Couldn’t locate the face image in the document

Extracts the signature image from an existing passport image. The source image must be 3”x 5”, 300 DPI, and true color (24-bit).

Syntax

GetSignature (sourceFile As String, destFile As String) As Long

Parameters

Parameter Description
sourceFile Full file name of the passport source file (including path)
destFile Full file name of the signature destination file (including path)

Return Values

Value Description
PASS_ERR_NONE Face image extracted successfully.
PASS_ERR_CANNOT_DELETE_ DESTINATION_IMAGE Can’t create file; a read-only file with that name already exists
PASS_ERR_CANNOT_COPY_ TO_DESTINATION Failed to copy the signature image to the destination drive
PASS_ERR_FACE_IMAGE_NOT_FOUND Couldn’t locate the signature image in the document

Extracts the face and signature images only from an ID

Syntax

GetFaceAndSignatureImagesOnly (Source As String, FaceDest As String, SignatureDest As String) As Long

Parameters

Value Description
[in] szSourceFile Full name of the source driver’s license image file
[in] szFaceDest Full name of the destination face image
[in] szSignatureDest Full name of the destination signature image

Return Values

Value Description
PASS_ERR_ FILE_OPEN Failed to open input image
INVALID_INTERNAL_IMAGE Invalid internal image file
PASS_FALSE Image processing failed
PASS_ERR_CANNOT_DELETE_ DESTINATION_IMAGE Can’t create file; a read-only file with that name already exists
PASS_ERR_CANNOT_COPY_ TO_DESTINATION Failed to copy the face image to the destination drive
PASS_ERR_FACE_IMAGE_ NOT_FOUND Failed to extract image; couldn’t locate the face rectangle image in the document

Extracts the face image from the document image to the given buffer

The source document image can be an existing image file (in BMP format) or the last scanned document (stored in the internal image buffer). If the SourceFile parameter is an empty string, then the image is taken from the internal image buffer. If this parameter contains the full name of a valid image file, then this file is used.

Syntax

GetFaceImageBuffer (Source As String, buffer As String, FileType As String) As Long

Parameters

Setting Description
[in] Source Name of the source driver’s license image file
[in] buffer A string buffer that contains the image content upon a successful return
[in] FileType Sets the buffer image format. May be one of the following strings (case insensitive): BMP | PNG | JPG | PCX | PSD | TIF

Return Values

Value Description
IMG_ERR_SUCCESS Function succeeded
BAD_IMAGE_DUMP Function failed

Extracts the signature image from the document image to the given buffer. The source document image can be an existing image file (in BMP format) or the last scanned document (stored in the internal image buffer). If the SourceFile parameter is an empty string, then the image is taken from the internal image buffer. If this parameter contains the full name of a valid image file, then this file is used.

Syntax

GetSignatureImageBuffer (Source As String, buffer As String, FileType As String) As Long

Parameters

Setting Description
[in] Source Name of the source driver’s license image file
[in] buffer A string buffer that contains the image content upon a successful return
[in] FileType Sets the buffer image format. May be one of the following strings (case insensitive): BMP | PNG | JPG | PCX | PSD | TIF

Return Values

Value Description
IMG_ERR_SUCCESS Function succeeded
BAD_IMAGE_DUMP Function failed

Clears data from all the fields in the passport class

Syntax

ResetPassportData ()

Parameters

None

Return Values

None

Verifies the field value with its checksum digit on the MRZ line (where it was taken from)

Syntax

int GetPassportMRZChecksumVerified (int FieldIndex)

Parameters

Parameter Description
[in] FieldIndex Constant value of the field

Return Values

Value Description
1 Verification success
0 Verification failed
-1 Not verified

Returns the first line of the MRZ zone (read-only)

Returns the second line of the MRZ zone (read/write)

Returns the Issue date if the passport is supported (read-only)

Syntax

IssueDate As String

Parameters

None

Return Values

Returns the IssueDate value as a string

Returns the place of birth if the passport is supported (read-only)

Returns the first name from the passport and not from the MRZ (read-only)

Returns the last name from the passport and not from the MRZ (read-only)

Returns a Date of Birth with the year in a 4-digit format (read-only)

Returns an Expiration Date with the year in a 4-digit format (read-only)

Returns an Issue Date with the year in a 4-digit format (read-only)

Property Description
NameLastNoneMRZ
DateOfBirth4 Returns the date of birth with year in 4 digits format (read-only)
ExpirationDate4 Returns expiry date with year in 4 digits format (read-only)
IssueDate4