CPassport library
IssueDate
GetPassportMRZChecksumVerified
Address2
Section titled “Address2”Returns the Address2 value in string format (read-only)
Syntax
Address2 As StringParameters
None
Return Values
Returns the Address2 value
Address3
Section titled “Address3”Returns the Address3 value in string format (read-only)
Syntax
Address3 As StringParameters
None
Return Values
Returns the Address3 value
Country
Section titled “Country”Returns the Country value in string format (read-only)
Syntax
Country As StringParameters
None
Return Values
Returns the Country value
CountryLong
Section titled “CountryLong”Returns the CountryLong value in string format (read-only)
Syntax
CountryLong As StringParameters
None
Return Values
Returns the CountryLong value
DateOfBirth
Section titled “DateOfBirth”Returns the DateOfBirth value as a string (read-only)
Syntax
DateOfBirth As StringParameters
None
Return Values
Returns a string with the DateOfBirth value
ExpirationDate
Section titled “ExpirationDate”Returns the ExpirationDate value in string format (read-only)
Syntax
ExpirationDate As StringParameters
None
Return Values
Returns a string with the ExpirationDate value
GetFace
Section titled “GetFace”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 LongParameters
| 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 |
GetFaceEx
Section titled “GetFaceEx”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 LongParameters
| 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 |
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(sSource As String, pBuf As String, sFileType As String, nStateID as Integer) As LongParameters
| 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 |
GetFaceImageBufferDirect
Section titled “GetFaceImageBufferDirect”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 StringParameters
| 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
InitLibrary
Section titled “InitLibrary”Initializes the library
Note: This function must be called before calling any other function in the library.
Syntax
InitLibrary(license As String) As LongParameters
| 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 |
IssueDate
Section titled “IssueDate”Returns the IssueDate in string format (read-only)
Syntax
IssueDate As StringParameters
None
Return Values
Returns the IssueDate value
NameFirst
Section titled “NameFirst”Returns the NameFirst value in string format
Syntax
NameFirst As StringParameters
None
Return Values
Returns the NameFirst value
NameLast
Section titled “NameLast”Returns the NameLast value in string format
Syntax
NameLast As StringParameters
None
Return Values
Returns the NameLast value
NameMiddle
Section titled “NameMiddle”Returns the NameMiddle value in string format
Syntax
NameMiddle As StringParameters
None
Return Values
Returns the NameMiddle value
Nationality
Section titled “Nationality”Returns the Nationality value in string format (read-only)
Syntax
Nationality As StringParameters
None
Return Values
Returns the Nationality value
NationalityLong
Section titled “NationalityLong”Returns the NationalityLong value in string format (read-only)
Syntax
NationalityLong As StringParameters
None
Return Values
Returns the NationalityLong value
PassportNumber
Section titled “PassportNumber”Returns the PassportNumber value in string format (read-only)
Syntax
PassportNumber As StringParameters
None
Return Values
Returns the PassportNumber value
PersonalNumber
Section titled “PersonalNumber”Returns the PersonalNumber value in string format (read-only)
Syntax
PersonalNumber As StringParameters
None
Return Values
Returns the PersonalNumber value
Process
Section titled “Process”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 StringParameters
None
Return Values
Returns the Sex value
ResetPassportData
Section titled “ResetPassportData”Clears data from all the fields in the passport class
Syntax
ResetPassportData()Parameters
None
Return Values
None
DateOfBirth4
Section titled “DateOfBirth4”Returns the DateOfBirth4 value in string format (read-only)
Syntax
DateOfBirth4 As StringParameters
None
Return Values
Returns the DateOfBirth4 value
ExpirationDate4
Section titled “ExpirationDate4”Returns the ExpirationDate4 value with a 4-digit year in string format (read-only)
Syntax
ExpirationDate4 As StringParameters
None
Return Values
Returns the ExpirationDate4 value
IssueDate4
Section titled “IssueDate4”Returns the IssueDate4 value with a 4-digit year in string format (read-only)
Syntax
IssueDate4 As StringParameters
None
Return Values
Returns the IssueDate4 value
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 |
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 |
GetSignatureImageBufferDirect
Section titled “GetSignatureImageBufferDirect”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 StringParameters
| 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
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] 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 |