GithubHelp home page GithubHelp logo

yushulx / razor-document-library Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 9.49 MB

A Razor Class Library built using the Dynamsoft Document Normalizer SDK.

Home Page: https://www.nuget.org/packages/RazorDocumentLibrary

License: MIT License

C# 27.72% HTML 39.14% JavaScript 14.81% CSS 18.33%
blazor csharp document-detection razor web

razor-document-library's Introduction

Razor Document Library

A Razor Class Library built using the Dynamsoft Document Normalizer SDK, which provides APIs for document edge detection and document rectification.

Demo Video

razor-document-library-blazor-document-scan.mp4

Online Demo

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

Prerequisites

Quick Usage

  • Import and initialize the Razor Document Library.

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

    await documentJsInterop.SetLicense(licenseKey);
    await documentJsInterop.LoadWasm();
  • Createa a document normalizer instance.

    DocumentNormalizer normalizer = await documentJsInterop.CreateDocumentNormalizer();
  • Detect document edges.

    Quadrilateral? result = await normalizer.DetectCanvas(canvas);
  • Rectify the document based on the detected edges.

    IJSObjectReference rectifiedDocument = await normalizer.RectifyCanvas(canvas, result.location);

API

Quadrilateral Class

Represents the coordinates of the four corners of a quadrilateral.

DocumentNormalizer Class

  • Task<Quadrilateral?> DetectCanvas(IJSObjectReference canvas): Detects document edges from a canvas.
  • Task<IJSObjectReference> RectifyCanvas(IJSObjectReference canvas, string location): Rectifies a document based on the detected edges.
  • Task SetFilter(string filter): Sets the filter for document edge detection.
  • Task ShowDocumentEditor(string elementId, IJSObjectReference imageCanvas, string location): Shows the document edge editor.
  • RegisterCallback(ICallback callback): Registers a callback function for receiving the coordinates of the four corners of a document.
  • Task ShowRectifiedDocument(string elementId, IJSObjectReference rectifiedDocument): Displays the rectified document within a specified HTML element.

DocumentJsInterop Class

  • Task LoadJS(): Loads the Dynamsoft Document Normalizer JavaScript library.
  • Task SetLicense(string license): Sets the license key.
  • Task LoadWasm(): Loads the Dynamsoft Document Normalizer WebAssembly module.
  • Task<MrzRecognizer> CreateDocumentNormalizer(): Creates a Document Normalizer instance.

Example

Build

cd RazorDocumentLibrary
dotnet build --configuration Release

razor-document-library's People

Contributors

yushulx avatar

Watchers

 avatar  avatar

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.