Coder Social home page Coder Social logo

mrzcode.net's Introduction

MRZCode.NET

MRZ (machine readable zone) parser for .NET. It supports following formats:

  • TD1 (3 lines, each has 30 characters),
  • TD2 (2 lines, each has 36 characters),
  • TD3 (2 lines, each has 44 characters),
  • MRVA (2 lines, each has 44 characters),
  • MRVB (2 lines, each has 36 characters).

Implementation bases on regex patterns form ultimateMRZ project.

Samples

    public static class GenericSample
    {
        public static void Run()
        {
            var codes = new[]
            {
                @"I<UTOD231458907<<<<<<<<<<<<<<<
7408122F1204159UTO<<<<<<<<<<<6
ERIKSSON<<ANNA<MARIA<<<<<<<<<<",
                @"I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
D231458907UTO7408122F1204159<<<<<<<6",
                @"P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10",
                @"V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L8988901C4XXX4009078F96121096ZE184226B<<<<<<",
                @"V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
L8988901C4XXX4009078F9612109<<<<<<<<"
            };

            Console.WriteLine("Parsing MRZ codes sample");
            foreach (var code in codes)
            {
                Console.WriteLine();
                Console.WriteLine(code);
                Console.WriteLine();
                
                var mrzCode = MrzCode.Parse(code);

                Console.WriteLine("Code type: {0}", mrzCode.Type);

                foreach (var fieldType in mrzCode.FieldTypes)
                {
                    Console.WriteLine("{0}: {1}", fieldType, mrzCode[fieldType]);    
                }
            }
        }
    }

More samples you can find in MRZCode.Samples folder.

Change log

v. 0.4.0

Support for Moldavian ID cards with no expiration date by itfintech

v. 0.3.0

Support for German ID cards by daniels7

mrzcode.net's People

Contributors

daniels7 avatar itfintech avatar snifter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mrzcode.net's Issues

Not working for German ID Cards (TD1) - Fix included

Hi,

this package is not working for German ID Cards (TD1) because the RegEx is partially wrong.
The RegEx for TD1FirstLine should be "([A|C|I][A-Z0-9<]{1})([A-Z<]{3})([A-Z0-9<]{9})([0-9]{1})([A-Z0-9<]{15})" and the RegEx for TD1SecondLine should be "([0-9]{6})([0-9]{1})([M|F|X|<]{1})([0-9]{6})([0-9]{1})([A-Z<]{3})([A-Z0-9<]{11})([0-9]{1})".

The reason is, that for the country string it can be up to 3 Letters, but it can be fewer as well. On German IDs the Country String would be "D<<" and not "DEU". That's why the RegEx has to accept "<" as input as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.