RazorMrzLibrary 1.0.0

dotnet add package RazorMrzLibrary --version 1.0.0
NuGet\Install-Package RazorMrzLibrary -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RazorMrzLibrary" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RazorMrzLibrary --version 1.0.0
#r "nuget: RazorMrzLibrary, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RazorMrzLibrary as a Cake Addin
#addin nuget:?package=RazorMrzLibrary&version=1.0.0

// Install RazorMrzLibrary as a Cake Tool
#tool nuget:?package=RazorMrzLibrary&version=1.0.0

Razor MRZ Library

A Razor Class Library built using the Dynamsoft Label Recognizer SDK, which provides APIs for scanning MRZ (Machine Readable Zone) on passports and IDs.

Online Demo

https://yushulx.me/Razor-MRZ-Library/

Prerequisites

Quick Usage

  • Import and initialize the Razor MRZ Library.

    @using RazorMrzLibrary
    
    @code {
        private MrzJsInterop? mrzJsInterop;
    
        protected override async Task OnInitializedAsync()
        {
            mrzJsInterop = new MrzJsInterop(JSRuntime);
            await mrzJsInterop.LoadJS();
        }
    }
    
  • Set the license key and load the wasm module.

    await mrzJsInterop.SetLicense(licenseKey);
    await mrzJsInterop.LoadWasm();
    
  • Createa a MRZ recognizer instance.

    MrzRecognizer recognizer = await mrzJsInterop.CreateMrzRecognizer();
    
  • Recognize MRZ text from an image.

    List<OcrResult> results = await recognizer.DecodeCanvas(canvas);
    
  • Parse MRZ text.

    string[] lines = new string[results.Count];
    for (int i = 0; i < results.Count; i++)
    {
        lines[i] = result.Text;
    }
    MrzResult mrzResult = MrzParser.Parse(lines);
    

API

OcrResult Class

Represents a line of text recognized by the OCR engine.

MrzResult Class

Represents the result of parsing MRZ text.

MrzParser Class

  • static MrzResult Parse(string[] lines): Parses MRZ text.

MrzRecognizer Class

  • Task<List<OcrResult>> DecodeCanvas(IJSObjectReference canvas): Recognizes MRZ text from a canvas object.

MrzJsInterop Class

  • Task LoadJS(): Loads the Dynamsoft Label Recognizer JavaScript library.
  • Task SetLicense(string license): Sets the license key.
  • Task LoadWasm(): Loads the Dynamsoft Label Recognizer WebAssembly module.
  • Task<MrzRecognizer> CreateMrzRecognizer(): Creates a MRZ recognizer instance.

Example

Build

cd RazorMrzLibrary
dotnet build --configuration Release
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 163 12/20/2023

- Added MRZ recognition API.