Skip to content
GBG Documents & Biometrics Documentation

CPassport library

Address2

Address3

Country

CountryLong

DateOfBirth

ExpirationDate

GetFace

GetFAceEx

GetFaceImageBuffer

GetFaceImageBufferDirect

InitLibrary

IssueDate

NameFirst

NameLast

NameMiddle

Nationality

NationalityLong

PassportNumber

PersonalNumber

Process

Sex

ResetPassportData

DateOfBirth4

ExpirationDate4

IssueDate4

GetPassportMRZChecksumVerified

GetSignature

GetSignatureImageBufferDirect

GetFaceAndSignatureImagesOnly

Returns the Address2 value in string format (read-only)

Syntax

Address2 As String

Parameters

None

Return Values

Returns the Address2 value

Returns the Address3 value in string format (read-only)

Syntax

Address3 As String

Parameters

None

Return Values

Returns the Address3 value

Returns the Country value in string format (read-only)

Syntax

Country As String

Parameters

None

Return Values

Returns the Country value

Returns the CountryLong value in string format (read-only)

Syntax

CountryLong As String

Parameters

None

Return Values

Returns the CountryLong value

Returns the DateOfBirth value as a string (read-only)

Syntax

DateOfBirth As String

Parameters

None

Return Values

Returns a string with the DateOfBirth value

Returns the ExpirationDate value in string format (read-only)

Syntax

ExpirationDate As String

Parameters

None

Return Values

Returns a string with the ExpirationDate value

Extracts the image rectangle of the person’s face from the source passport image. Remember that the original scanned image must be rotated by 180 degrees (so it is aligned correctly) before this function is called. This function works properly only for 3”x5” images. The destination image is generated in BITMAP format.

Syntax

GetFace(Source As String) As Long

Parameters

Parameter Description
[in] DestFile Null-terminated string that contains the full name of the destination image file (which contains the face image from the passport)

Return Values

Value Description
PASS_ERR_NONE Function succeeded
LICENSE_INVALID License invalid; library not initialized with proper license
PASS_ERR_CANNOT_DELETE_ DESTINATION_IMAGE Returned when file with same name as destination file already exists and can’t be overwritten
PASS_ERR_CANNOT_COPY_ TO_DESTINATION Returned when destination file can’t be opened for write on the disk
PASS_ERR_FACE_IMAGE_ NOT_FOUND Could not retrieve the face image from the passport image

Extracts the image rectangle of the person’s face from the source passport image. Remember that the original scanned image must be rotated by 180 degrees (so it is aligned correctly) before this function is called. This function works properly only for 3”x5” images. The destination image is generated in BITMAP format.

Syntax

GetFaceEx(srcFile As String, dstFile As String) As Long

Parameters

Parameter Description
[in] srcFile Full path and name of the passport source file
[in] dstFile Full path and name of the passport destination file

Return Values

Value Description
PASS_ERR_NONE Face extracted successfully
PASS_ERR_CANNOT_DELETE_ DESTINATION_IMAGE Returned when file with same name as destination file already exists and can’t be overwritten
PASS_ERR_CANNOT_COPY_ TO_DESTINATION Failed to copy the face image to the destination file
PASS_ERR_FACE_IMAGE_ NOT_FOUND Can’t locate the face image on 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(sSource As String, pBuf As String, sFileType As String, nStateID as Integer) As Long

Parameters

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

Return Values

Value Description
ID_TRUE Function succeeded
ID_FALSE Function failed

Gets a copy of the internal image buffer. 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

GetFaceImageBufferDirect(sSource As String, sFileType As String) As String

Parameters

Parameter Description
sFileType Sets the buffer image format. May be one of the following strings (case-insensitive): BMP | PNG | JPG | PCX | PSD | TGA | TIF

Return Values

Returns the image buffer in string format

Initializes the 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 holds the license key value

Return Values

Value Description
LICENSE_VALID License is valid and library is ready to 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: ScanShell 600 | ScanShell 800 | ScanShell 1000

Returns the IssueDate in string format (read-only)

Syntax

IssueDate As String

Parameters

None

Return Values

Returns the IssueDate value

Returns the NameFirst value in string format

Syntax

NameFirst As String

Parameters

None

Return Values

Returns the NameFirst value

Returns the NameLast value in string format

Syntax

NameLast As String

Parameters

None

Return Values

Returns the NameLast value

Returns the NameMiddle value in string format

Syntax

NameMiddle As String

Parameters

None

Return Values

Returns the NameMiddle value

Returns the Nationality value in string format (read-only)

Syntax

Nationality As String

Parameters

None

Return Values

Returns the Nationality value

Returns the NationalityLong value in string format (read-only)

Syntax

NationalityLong As String

Parameters

None

Return Values

Returns the NationalityLong value

Returns the PassportNumber value in string format (read-only)

Syntax

PassportNumber As String

Parameters

None

Return Values

Returns the PassportNumber value

Returns the PersonalNumber value in string format (read-only)

Syntax

PersonalNumber As String

Parameters

None

Return Values

Returns the PersonalNumber value

Processes the recently scanned passport image

When scanning the passport page using the ScanShell 1000, the opened page should be aligned to the top right corner, which yields a rotated internal image. Before processing the image, it needs to be rotated by 180 degrees (using the RotateImage function).

The image should contain the following properties:

  • Color scheme: Select one of the following:
    • 24 bit (True color)
    • 256 Gray shades
  • Image size: Select one of the following:
    • 3” x 5”: This scans the full page of the passport
    • 1” x 5”: This scans only the lower portion of the page.

After the function returns PASS_ERR_NONE, the library properties will be loaded with analyzed text. Otherwise, the library property fields will be empty. The raw data is scanned for format detection. If a specific format is detected, the data is parsed further and loads the library properties.

Syntax

Process(fileName As String) As Long

Parameters

Parameter Description
[in] fileName

Return Values

Value Description
PASS_ERR_NONE Function succeeded
LICENSE_INVALID Library not initialized with the proper license
INVALID_INTERNAL_IMAGE No internal image loaded; must scan an image first

Returns the Sex value in string format (read-only)

Syntax

Sex As String

Parameters

None

Return Values

Returns the Sex value

Clears data from all the fields in the passport class

Syntax

ResetPassportData()

Parameters

None

Return Values

None

Returns the DateOfBirth4 value in string format (read-only)

Syntax

DateOfBirth4 As String

Parameters

None

Return Values

Returns the DateOfBirth4 value

Returns the ExpirationDate4 value with a 4-digit year in string format (read-only)

Syntax

ExpirationDate4 As String

Parameters

None

Return Values

Returns the ExpirationDate4 value

Returns the IssueDate4 value with a 4-digit year in string format (read-only)

Syntax

IssueDate4 As String

Parameters

None

Return Values

Returns the IssueDate4 value

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

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

Gets a copy of the internal image buffer. If successful, the function will format the image according to the image format specified in the sFileType parameter. The application can dump the content of the return buffer data to the hard drive as a binary file while assigning it a proper file extension, creating a standard image file.

Syntax

GetSignatureImageBufferDirect(sSource As String, sFileType As String) As String

Parameters

Parameter Description
sSource Full path and name of the passport source file
sFileType Sets the buffer image format. May be one of the following strings (case insensitive): BMP | PNG | JPG | PCX | PSD | TIF | TGA

Return Values

Returns a string buffer that contains the image content upon a successful return

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] SourceFile Full name of the source driver’s license image file
[in] FaceDest Full name of the destination face image
[in] SignatureDest Full name of the destination signature image

Return Values

Value Description
PASS_ERR_NONE Function completed successfully
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