RazorDocumentLibrary 1.0.1

dotnet add package RazorDocumentLibrary --version 1.0.1
NuGet\Install-Package RazorDocumentLibrary -Version 1.0.1
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="RazorDocumentLibrary" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RazorDocumentLibrary --version 1.0.1
#r "nuget: RazorDocumentLibrary, 1.0.1"
#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 RazorDocumentLibrary as a Cake Addin
#addin nuget:?package=RazorDocumentLibrary&version=1.0.1

// Install RazorDocumentLibrary as a Cake Tool
#tool nuget:?package=RazorDocumentLibrary&version=1.0.1

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

https://github.com/yushulx/Razor-Document-Library/assets/2202306/b842c8b7-d0b6-47f1-9d04-a96475f8d5c4

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
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.1 164 12/27/2023
1.0.0 92 12/27/2023

- Updated README.md