#!/usr/bin/python3 # -*- coding: utf-8 -*- # Note for end users: ####################################################################### # # Adding mrz (local) to PYTHONPATH to execute this example as a script without installing mrz # (if it was installed using pip or setup.py the three lines below are not necessary) from os.path import dirname, join, pardir, realpath import sys sys.path.append(realpath(join(dirname(__file__), pardir, pardir))) ############################################################################################## from mrz.generator.mrva import MRVBCodeGenerator from examples.functions.functions import open_image print( MRVBCodeGenerator( "VN", # Document type For visas, the first letter must be 'V' "USA", # Country 3 letters code or country name "TRAVELER", # Surname(s) Special characters will be transliterated "HAPPY", # Given name(s) Special characters will be transliterated "123456789", # Document number "CAN", # Nationality 3 letter code or country name "661212", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "140728", # Expiry date YYMMDD "B3XLC000FD142955")) # Optional data Not mandatory field open_image("visas", "USA.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import * from examples.functions.functions import open_image # search for a country by pattern listing the possible results print("\n".join(find_country("REPUBLIC"))) # get the code of a country code = get_code("Czech republic") print( TD3CodeGenerator( "P", # Document type Normally 'P' for passport code, # Country 3 letters code or country name "SPECIMEN", # Surname(s) Special characters will be transliterated "Vzor", # Given name(s) Special characters will be transliterated "99003853", # Passport number code, # Nationality 3 letter code or country name "110101", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "120704", # Expiry date YYMMDD "110101111")) # Id number Non-mandatory field in some countries open_image("passports", "Czech_Republic.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td1 import TD1CodeGenerator from examples.functions.functions import open_image print( TD1CodeGenerator( "I", # Document type Normally 'I' or 'ID' for id cards "Monaco", # Country 3 letters code or country name "029067", # Document number "990101", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "090324", # Expiry date YYMMDD "Monaco", # Nationality "SPECIMEN", # Surname Special characters will be transliterated "SPECIMEN") ) # Given name(s) Special characters will be transliterated open_image("id_cards", "Monaco.png")
from mrz.generator.mrvb import MRVBCodeGenerator from examples.functions.functions import open_image print( MRVBCodeGenerator( "VC", # Document type For visas, the first letter must be 'V' "FRA", # Country 3 letters code or country name "SPECIMEN", # Surname(s) Special characters will be transliterated "SPECIMEN", # Given name(s) Special characters will be transliterated "F00000000", # Document number "UTO", # Nationality 3 letter code or country name "031106", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "140114", # Expiry date YYMMDD " M300703")) # Optional data Not mandatory field open_image("visas", "France.png")
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Adding mrz to PYTHONPATH to execute this example as script from os.path import dirname, join, pardir, realpath import sys sys.path.append(realpath(join(dirname(__file__), pardir, pardir))) ############################################################# #!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import TD3CodeGenerator from examples.functions.functions import open_image print( TD3CodeGenerator( "P", # Document type Normally 'P' for passport "Interpol", # Country 3 letters code or country name "SPECIMEN", # Surname(s) Special characters will be transliterated "SAMPLE", # Given name(s) Special characters will be transliterated "XX000000", # Passport number "FRANCE", # Nationality 3 letter code or country name "750101", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "190730", # Expiry date YYMMDD "1234567890")) # Id number Non-mandatory field in some countries open_image("passports", "Interpol.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td1 import * from examples.functions.functions import open_image print( TD1CodeGenerator( "ID", # Document type Normally 'I' or 'ID' for id cards "Serbia", # Country 3 letters code or country name "955555546", # Document number Special characters will be transliterated "680229", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "130724", # Expiry date YYMMDD "Serbia", # Nationality "ТЕСТ", # Surname Special characters will be transliterated "МИЛИЦА", # Given name(s) Special characters will be transliterated "2902968000000", # Optional data 1 empty string by default "", # Optional data 2 empty string by default dictionary.cyrillic_serbian()) ) # Transliteration Dictionary (latin by default) open_image("id_cards", "Serbia.png")
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Adding mrz to PYTHONPATH to execute this example as script from os.path import dirname, join, pardir, realpath import sys sys.path.append(realpath(join(dirname(__file__), pardir, pardir))) ############################################################# from mrz.generator.mrvb import MRVBCodeGenerator from examples.functions.functions import open_image print(MRVBCodeGenerator( "VB", # Document type For visas, the first letter must be 'V' "D", # Country 3 letters code or country name. Note: Germany it's an # exception. Only uses one letter "DEDIC", # Surname(s) Special characters will be transliterated "SIDNAN", # Given name(s) Special characters will be transliterated "D09174053", # Document number "BOS", # Nationality 3 letter code or country name "820113", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "970801", # Expiry date YYMMDD " 2020711", # Optional data Not mandatory field force=True)) # Force Disables checks for country, nationality and document_type # fields. Note: 'BOS' is deprecated or non-normative open_image("visas", "Germany.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td1 import TD1CodeGenerator from examples.functions.functions import open_image print( TD1CodeGenerator( "I", # Document type Normally 'I' or 'ID' for id cards "LTU", # Country 3 letters code or country name "11810187", # Document number "641123", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "190101", # Expiry date YYMMDD "LTU", # Nationality "BASANAVIČIENĖ", # Surname Special characters will be transliterated "BIRUTĖ", # Given name(s) Special characters will be transliterated "46411231034")) # Optional data 1 open_image("id_cards", "Lithuania.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td1 import TD1CodeGenerator from examples.functions.functions import open_image print( TD1CodeGenerator( "I", # Document type Normally 'I' or 'ID' for id cards "LVA", # Country 3 letters code or country name "PA9992921", # Document number "821212", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "170305", # Expiry date YYMMDD "LVA", # Nationality "PARAUDZINŠ", # Surname Special characters will be transliterated "ANDRIS", # Given name(s) Special characters will be transliterated "121282-88882")) # Optional data 1 empty string by default open_image("id_cards", "Latvia.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import TD3CodeGenerator, dictionary from examples.functions.functions import open_image print( TD3CodeGenerator( "P", # Document type Normally 'P' for passport "ASU", # Country 3 letters code or country name "محمود", # Surname(s) Special characters will be transliterated "عبدالرحيم", # Given name(s) Special characters will be transliterated "A2222222", # Passport number "ASU", # Nationality 3 letter code or country name "710821", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "041204", # Expiry date YYMMDD "1000146819", # Id number Not mandatory field dictionary.arabic(), # Dictionary Transliteration dictionary force=True) ) # Force Disables checks for country, nationality and document_type fields. open_image("passports", "ICAO_Example2.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td1 import TD1CodeGenerator from examples.functions.functions import open_image print( TD1CodeGenerator( "I", # Document type Normally 'I' or 'ID' for id cards "Sweden", # Country 3 letters code or country name "59000002", # Document number Special characters will be transliterated "870314", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "170102", # Expiry date YYMMDD "SWEDEN", # Nationality "SPECIMEN", # Surname Special characters will be transliterated "SVEN", # Given name(s) Special characters will be transliterated "198703142391")) open_image("id_cards", "Sweden.png")
from mrz.generator.mrvb import MRVBCodeGenerator from examples.functions.functions import open_image print( MRVBCodeGenerator( "VD", # Document type For visas, the first letter must be 'V' "GBR", # Country 3 letters code or country name "MUNIR", # Surname(s) Special characters will be transliterated "FAISAL", # Given name(s) Special characters will be transliterated "AD0725981", # Document number "PAK", # Nationality 3 letter code or country name "760815", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "061116")) # Expiry date YYMMDD open_image("visas", "United_Kingdom.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import TD3CodeGenerator from examples.functions.functions import open_image print( TD3CodeGenerator( "P", # Document type Normally 'P' for passport "QATAR", # Country 3 letters code or country name "AL-KAABI", # Surname(s) "ALI HAMAD ABDULLAH", # Given Names Special characters will be transliterated "00000000", # Passport number Special characters will be transliterated "QAT", # Nationality 3 letter code or country name "710307", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "110725", # Expiry date YYMMDD "12345458902") ) # Id number Non-mandatory field in some countries open_image("passports", "Qatar.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- # Adding mrz to PYTHONPATH to execute this example as script from os.path import dirname, join, pardir, realpath import sys sys.path.append(realpath(join(dirname(__file__), pardir, pardir))) ############################################################# from mrz.generator.td1 import TD1CodeGenerator from examples.functions.functions import open_image print(TD1CodeGenerator("I", # Document type Normally 'I' or 'ID' for id cards "PER", # Country 3 letters code or country name "70275722", # Document number "890612", # Birth date YYMMDD "M", # Genre Male: 'M', Female: 'F' or Undefined 'X' "210716", # Expiry date YYMMDD "PER", # Nationality "Cárdenas", # Surname Special characters will be transliterated "Jorge Anthony")) # Given name(s) Special characters will be transliterated open_image("id_cards", "Peru.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import * from examples.functions.functions import open_image print( TD3CodeGenerator( "PA", # Document type Normally 'P' for passport "Iceland", # Country 3 letters code or country name "ÆVARSDÓTTIR", # Surname(s) Special characters will be transliterated "ÞURÍÐUR ÖSP", # Given name(s) Special characters will be transliterated "A2040611", # Passport number "ICELAND", # Nationality 3 letter code or country name "121212", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "110629", # Expiry date YYMMDD "121212-1239") ) # Id number Non-mandatory field in some countries open_image("passports", "Iceland.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td2 import TD2CodeGenerator from examples.functions.functions import open_image print( TD2CodeGenerator( "I", # Document type Normally 'I' or 'ID' for id cards "Utopia", # Country 3 letters code or country name "ERIKSSON", # Surname Special characters will be transliterated "ANNA MARIA", # Given name(s) Special characters will be transliterated "D23145890", # Genre Male: 'M', Female: 'F' or Undefined 'X' "UTO", # Nationality 3 letters code or country name "740812", # Birth Date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "120415")) # Expiry date YYMMDD open_image("other", "TD2_ICAO_Example.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import TD3CodeGenerator from examples.functions.functions import open_image print( TD3CodeGenerator( "P", # Document type Normally 'P' for passport "TAIWAN", # Country 3 letters code or country name "LIN", # Surname(s) Special characters will be transliterated "MEI-HUA", # Given name(s) Special characters will be transliterated "000000000", # Passport number "TAIWAN", # Nationality 3 letter code or country name "760101", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "140401", # Expiry date YYMMDD "A234567893")) # Id number Non-mandatory field in some countries open_image("passports", "China.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- # Adding mrz path to PYTHONPATH to execute the example as script from os.path import dirname, join, pardir, realpath import sys sys.path.append(realpath(join(dirname(__file__), pardir, pardir))) ################################################################## from mrz.generator.td1 import TD1CodeGenerator from mrz.checker.td1 import TD1CodeChecker import examples.functions.functions as functions mrz = str(TD1CodeGenerator("I", "LTU", "11810187", "201123", "F", "300101", "LTU", "BASANAVIČIENĖ", "BIRUTĖ", "46411231034")) td1_check = TD1CodeChecker(mrz) print(td1_check) td1_check = TD1CodeChecker(mrz, check_expiry=True) if not bool(td1_check): print("FALSE:") print(td1_check.report_falses) functions.open_image("id_cards", "Lithuania.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import * from examples.functions.functions import open_image print( TD3CodeGenerator( "P", # Document type Normally 'P' for passport "JPN", # Country 3 letters code or country name "GAIMU", # Surname(s) Special characters will be transliterated "SAKURA", # Given name(s) Special characters will be transliterated "XS1234567", # Passport number "Japan", # Nationality 3 letter code or country name "790220", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "160320")) # Expiry date YYMMDD open_image("passports", "Japan.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td3 import * from examples.functions.functions import open_image print(TD3CodeGenerator( "P", # Document type Normally 'P' for passport "UKRAINE", # Country 3 letters code or country name "ТКАЧЕНКО", # Surname(s) Special characters will be transliterated "МАР'ЯНА", # Given name(s) Special characters will be transliterated "XX000000", # Passport number "UKRAINE", # Nationality 3 letter code or country name "910824", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "230925", # Expiry date YYMMDD "1234567890", # Id number Not mandatory field dictionary.cyrillic_ukrainian())) # Dictionary Transliteration dictionary open_image("passports", "Ukraine.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- # Adding mrz to PYTHONPATH to execute this example as script from os.path import dirname, join, pardir, realpath import sys sys.path.append(realpath(join(dirname(__file__), pardir, pardir))) ############################################################# from mrz.generator.mrvb import MRVBCodeGenerator from examples.functions.functions import open_image print(MRVBCodeGenerator( "V", # Document type For visas, the first letter must be 'V' "UTO", # Country 3 letters code or country name "ERIKSSON", # Surname(s) Special characters will be transliterated "ANNA MARIA", # Given name(s) Special characters will be transliterated "L8988901C", # Document number "Unknown", # Nationality 3 letter code or country name "400907", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "961210")) # Expiry date YYMMDD open_image("visas", "MRVB_ICAO_Example.png")
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from mrz.generator.td1 import TD1CodeGenerator import examples.functions.functions as oi print( TD1CodeGenerator( "ID", # Document type Normally 'I' or 'ID' for id cards "LIE", # Country 3 letters code or country name "ID9875401", # Document number "820512", # Birth date YYMMDD "F", # Genre Male: 'M', Female: 'F' or Undefined 'X' "190622", # Expiry date YYMMDD "LIE", # Nationality "OSPELT-BECK", # Surname Special characters will be transliterated "Marisa")) # Given name(s) Special characters will be transliterated oi.open_image("id_cards", "Liechtenstein.png")