Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tony-xlh/capacitor-plugin-dynamsoft-document-normalizer

A document scanning plugin for Capacitor using Dynamsoft Document Normalizer
https://github.com/tony-xlh/capacitor-plugin-dynamsoft-document-normalizer

Last synced: 3 months ago
JSON representation

A document scanning plugin for Capacitor using Dynamsoft Document Normalizer

Awesome Lists containing this project

README

        

# capacitor-plugin-dynamsoft-document-normalizer

A document scanning plugin for Capacitor using [Dynamsoft Document Normalizer](https://www.dynamsoft.com/document-normalizer/docs/).

[Online demo](https://chic-syrniki-fac13f.netlify.app/)

## Versions

For Capacitor v6, use versions >= 3.0.

For Capacitor v5, use versions 1.x and 2.x.

For Capacitor v4, use v0.x.

## SDK Versions Used for Different Platforms

| Product | Android | iOS | Web |
| ----------- | ----------- | ----------- | ------- |
| Dynamsoft Document Normalizer | 2.x | 2.x | 2.x |

## Supported Platforms

* Web
* Android
* iOS

## Install

```bash
npm install capacitor-plugin-dynamsoft-document-normalizer
npx cap sync
```

## API

* [`initialize()`](#initialize)
* [`initLicense(...)`](#initlicense)
* [`initRuntimeSettingsFromString(...)`](#initruntimesettingsfromstring)
* [`detect(...)`](#detect)
* [`detectBitmap(...)`](#detectbitmap)
* [`normalize(...)`](#normalize)
* [`detectAndNormalize(...)`](#detectandnormalize)
* [`setEngineResourcePaths(...)`](#setengineresourcepaths)
* [Interfaces](#interfaces)

### initialize()

```typescript
initialize() => Promise
```

--------------------

### initLicense(...)

```typescript
initLicense(options: { license: string; }) => Promise
```

| Param | Type |
| ------------- | --------------------------------- |
| **`options`** | { license: string; } |

--------------------

### initRuntimeSettingsFromString(...)

```typescript
initRuntimeSettingsFromString(options: { template: string; }) => Promise
```

| Param | Type |
| ------------- | ---------------------------------- |
| **`options`** | { template: string; } |

--------------------

### detect(...)

```typescript
detect(options: { path?: string; source?: string | HTMLImageElement | HTMLCanvasElement; template?: string; }) => Promise<{ results: DetectedQuadResultItem[]; }>
```

source: Android and iOS only support base64 string.
path: for Android and iOS.
template: pass a template name to specify the template

| Param | Type |
| ------------- | ---------------------------------------------------------------- |
| **`options`** | { path?: string; source?: any; template?: string; } |

**Returns:** Promise<{ results: DetectedQuadResultItem[]; }>

--------------------

### detectBitmap(...)

```typescript
detectBitmap(options: { className?: string; methodName?: string; template?: string; }) => Promise<{ results: DetectedQuadResultItem[]; }>
```

Android and iOS only method which directly reads camera frames from capacitor-plugin-camera. Pass a template name to specify the template.

| Param | Type |
| ------------- | ---------------------------------------------------------------------------- |
| **`options`** | { className?: string; methodName?: string; template?: string; } |

**Returns:** Promise<{ results: DetectedQuadResultItem[]; }>

--------------------

### normalize(...)

```typescript
normalize(options: { path?: string; source?: string | HTMLImageElement | HTMLCanvasElement; quad: Quadrilateral; template?: string; saveToFile?: boolean; includeBase64?: boolean; }) => Promise<{ result: NormalizedImageResult; }>
```

source: Android and iOS only support base64 string.
path: for Android and iOS.
template: pass a template name to specify the template

| Param | Type |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`options`** | { path?: string; source?: any; quad: Quadrilateral; template?: string; saveToFile?: boolean; includeBase64?: boolean; } |

**Returns:** Promise<{ result: NormalizedImageResult; }>

--------------------

### detectAndNormalize(...)

```typescript
detectAndNormalize(options: { path?: string; source?: string | HTMLImageElement | HTMLCanvasElement; template?: string; saveToFile?: boolean; includeBase64?: boolean; }) => Promise<{ result: NormalizedImageResult; }>
```

source: Android and iOS only support base64 string.
path: for Android and iOS.
template: pass a template name to specify the template

| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------- |
| **`options`** | { path?: string; source?: any; template?: string; saveToFile?: boolean; includeBase64?: boolean; } |

**Returns:** Promise<{ result: NormalizedImageResult; }>

--------------------

### setEngineResourcePaths(...)

```typescript
setEngineResourcePaths(options: { paths: any; }) => Promise
```

Web Only

| Param | Type |
| ------------- | ---------------------------- |
| **`options`** | { paths: any; } |

--------------------

### Interfaces

#### DetectedQuadResultItem

| Prop | Type |
| ---------------------------------- | ------------------------------------------------------- |
| **`location`** | Quadrilateral |
| **`confidenceAsDocumentBoundary`** | number |

#### Quadrilateral

| Prop | Type |
| ------------ | ----------------------------------------------------------------------------------- |
| **`points`** | [Point, Point, Point, Point] |
| **`area`** | number |

#### Point

| Prop | Type |
| ------- | ------------------- |
| **`x`** | number |
| **`y`** | number |

#### NormalizedImageResult

| Prop | Type |
| ------------ | ------------------- |
| **`base64`** | string |
| **`path`** | string |