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:
- GetFaceEx
- GetSignature
- GetFaceAndSignatureImagesOnly
- GetFaceImageBuffer
- ResetPassportData
- GetPassportMRZChecksumVerified
GetFaceEx
Section titled “GetFaceEx”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 LongParameters
| 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 |
GetSignature
Section titled “GetSignature”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 LongParameters
| 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 |
GetFaceAndSignatureImagesOnly
Section titled “GetFaceAndSignatureImagesOnly”Extracts the face and signature images only from an ID
Syntax
GetFaceAndSignatureImagesOnly (Source As String, FaceDest As String, SignatureDest As String) As LongParameters
| 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 |
GetFaceImageBuffer
Section titled “GetFaceImageBuffer”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 LongParameters
| 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 |
GetSignatureImageBuffer
Section titled “GetSignatureImageBuffer”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 LongParameters
| 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 |
ResetPassportData
Section titled “ResetPassportData”Clears data from all the fields in the passport class
Syntax
ResetPassportData ()Parameters
None
Return Values
None
GetPassportMRZChecksumVerified
Section titled “GetPassportMRZChecksumVerified”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 |
CPassport library properties
Section titled “CPassport library properties”Address2
Section titled “Address2”Returns the first line of the MRZ zone (read-only)
Address3
Section titled “Address3”Returns the second line of the MRZ zone (read/write)
IssueDate
Section titled “IssueDate”Returns the Issue date if the passport is supported (read-only)
Syntax
IssueDate As StringParameters
None
Return Values
Returns the IssueDate value as a string
End_POB
Section titled “End_POB”Returns the place of birth if the passport is supported (read-only)
NameFirstNoneMRZ
Section titled “NameFirstNoneMRZ”Returns the first name from the passport and not from the MRZ (read-only)
NameLastNoneMRZ
Section titled “NameLastNoneMRZ”Returns the last name from the passport and not from the MRZ (read-only)
DateOfBirth4
Section titled “DateOfBirth4”Returns a Date of Birth with the year in a 4-digit format (read-only)
ExpirationDate4
Section titled “ExpirationDate4”Returns an Expiration Date with the year in a 4-digit format (read-only)
IssueDate4
Section titled “IssueDate4”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 |