-
Notifications
You must be signed in to change notification settings - Fork 2
API Reference
Package:
org.idpass.smartscanner.mrz.parser.innovatrics
The main API providing methods for working with MRZ records and strings.
Checks if given character is valid in MRZ.
Parameters:
Parameter | Type | Description |
---|---|---|
c |
char |
The character to check. |
Return:
boolean
, whether the given character is valid or not.
Computes MRZ check digit for given string of characters.
Parameters:
Parameter | Type | Description |
---|---|---|
str |
String |
The string to compute the check digit for. |
Return:
int
, the check digit in the range of 0
to 9
.
Computes MRZ check digit for given string of characters. Similar to computeCheckDigit
but returns a char
instead of an int
.
Parameters:
Parameter | Type | Description |
---|---|---|
str |
String |
The string to compute the check digit for. |
Return:
char
, the check digit in the range of 0
to 9
.
Parses an MRZ string and returns appropriate record class.
Parameters:
Parameter | Type | Description |
---|---|---|
mrz |
String |
The MRZ string to parse. |
Return:
An instance of a subclass of MrzRecord
depending on the detected MRZ type.
Similar to parse
but returns an MrtdTd1
instance.
Parameters:
Parameter | Type | Description |
---|---|---|
mrz |
String |
The MRZ string to parse. |
Return:
The parsed MrtdTd1
record.
Converts the given string into an MRZ string: removes all accents, converts the string to uppercase, and replaces all spaces and invalid characters with <
.
Parameters:
Parameter | Type | Description |
---|---|---|
string |
String |
The string to convert. Passing null is the same as passing in an empty string. |
length |
int |
The required length of the string. If given string is longer, it is truncated. If given string is shorter than given length, < characters are appended at the end. If -1, the string is neither truncated nor enlarged. |
Return:
A valid MRZ String
.
Converts a surname and given names to a MRZ string, shortening them as per Doc 9303 Part 3 Vol 1 Section 6.7 of the MRZ specification when necessary.
Parameters:
Parameter | Type | Description |
---|---|---|
surname |
String |
The surname, should not be blank. |
givenNames |
String |
The given names, should not be blank. |
length |
int |
The required length of the string. If given string is longer, it is shortened. If given string is shorter than given length, '<' characters are appended at the end. |
Return:
String
. The names properly converted to a valid MRZ format of SURNAME<<GIVENNAMES<...
, with the exact length of given length
.
Package:
org.idpass.smartscanner.mrz.parser.innovatrics
An abstract MRZ record, contains basic information present in all MRZ record types.
Property | Type | Description |
---|---|---|
code |
MrzDocumentCode |
The document code. |
code1 |
char |
The document code, see MrzDocumentCode for allowed values. |
code2 |
char |
|
issuingCountry |
String |
An ISO 3166-1 alpha-3 country code of the issuing country, with additional allowed values. |
documentNumber |
String |
The document number, e.g. passport number. |
surname |
String |
The surname in uppercase characters. |
givenNames |
String |
The given names in uppercase characters, separated by spaces. |
dateOfBirth |
MrzDate |
The date of birth. |
sex |
MrzString |
The sex. |
expirationDate |
MrzDate |
The expiration date of the passport. |
nationality |
String |
An ISO 3166-1 alpha-3 country code of nationality. |
format |
MrzFormat |
The detected MRZ format. |
Parses the MRZ string and assigns values to the instance properties.
Parameters:
Parameter | Type | Description |
---|---|---|
mrz |
String |
The MRZ string to parse, separated by \n and should not be null . |
Helper method to set the full name. Changes both surname
and givenNames
.
Parameter | Type | Description |
---|---|---|
name |
String[] |
Array of names with two elements, in the form [surname, givenNames] . |
Serializes this record to a valid MRZ string.
Return:
A valid MRZ String
, each line separated by \n
.