Skip to content

Latest commit

 

History

History
311 lines (214 loc) · 6.25 KB

File metadata and controls

311 lines (214 loc) · 6.25 KB
layout default-layout
needAutoGenerateSidebar true
title Dynamic Web TWAIN SDK API Reference - OCR Addon APIs
keywords Dynamic Web TWAIN, Documentation, API Reference, OCR Addon APIs
breadcrumbText OCR Addon
description Dynamic Web TWAIN SDK Documentation API Reference OCR Addon APIs Page

{WebTwainObject}.Addon.OCRKit

{WebTwainObject} denotes the WebTwain instance.

Methods

| GetInstalledOCRInfo() | DetectPageOrientation() | Recognize() | SaveToPath() | | SaveAsBase64() | SaveAsBlob() | | |


GetInstalledOCRInfo()

Return the info of the installed OCR addon. It will throw an error if the OCR module is not installed.

Syntax

GetInstalledOCRInfo(): Promise<OCRInfo>;

Return Values

Promise of an OCRInfo object.

Availability

H5(Windows) H5(macOS) H5(Linux)
v19.3+ not supported not supported

DetectPageOrientation()

Syntax

DetectPageOrientation( 
  index: number,  
  settings?: { 
    detectionMode?: EnumDWT_PageOrientationDetectionMode | number
  }
): Promise<{angle: EnumDWT_PageOrientation | number, confidence: number}>; 

Parameters

index: Index of the image to process.

settings: Settings of the method. You can configure the accuracy mode. Please refer to EnumDWT_PageOrientationDetectionMode.

Return Values

Promise of an object of the orientation detection result. Please refer to EnumDWT_PageOrientation.

Availability

H5(Windows) H5(macOS) H5(Linux)
v19.3+ not supported not supported

Recognize()

Recognize the text in one page.

Syntax

Recognize( 
  index: number,
  options?: {
    settings?: { 
      language?: string,
      pageOrientation?: EnumDWT_PageOrientation| number,
    },  
    rects?: { 
      left: number, 
      top: number, 
      right: number, 
      bottom: number
    }[]
  }
): Promise<OCRResult>;  

Parameters

index: Index of the image to process.

options:

  • settings: Settings of the recognition.
    • language: Specify the code of language for recognition (en, fr, e.g.). See the table below listing supported languages.
    • pageOrientation: Specify the orientation of the page. The OCR will rotate the page before recognition. Please refer to EnumDWT_PageOrientation.
  • rects: An array of rectangles to limit the regions for recognition.

Return Values

Promise of the OCRResult object.

Supported Languages

Language Name Code
English en
French fr
Spanish es
German de
Italian it
Portuguese pt

Availability

H5(Windows) H5(macOS) H5(Linux)
v19.3+ not supported not supported

SaveToPath()

Save the result to a local path.

Syntax

SaveToPath(
  indices: number[],  
  outputFormat: Dynamsoft.DWT.EnumDWT_OCRKitOutputFormat | number,  
  path: string
): Promise<boolean>;

Parameters

indices: Indices of the pages to save.

outputFormat: Please refer to EnumDWT_OCRKitOutputFormat.

path: System's absolute path or filename for saving. A file saving dialog will appear for confirmation.

Return Values

Promise of a boolean result indicating the success of the operation.

Availability

H5(Windows) H5(macOS) H5(Linux)
v19.3+ not supported not supported

SaveAsBase64()

Save the result as base64.

Syntax

SaveAsBase64(
  indices: number[],
  outputFormat: Dynamsoft.DWT.EnumDWT_OCRKitOutputFormat | number
): Promise<string>;

Parameters

indices: Indices of the pages to save.

outputFormat: Please refer to EnumDWT_OCRKitOutputFormat.

Return Values

Promise of a base64 string result.

Availability

H5(Windows) H5(macOS) H5(Linux)
v19.3+ not supported not supported

SaveAsBlob()

Save the result as blob.

Syntax

SaveAsBlob(
  indices: number[],  
  outputFormat: Dynamsoft.DWT.EnumDWT_OCRKitOutputFormat | number
): Promise<Blob>;

Parameters

indices: Indices of the pages to save.

outputFormat: Please refer to EnumDWT_OCRKitOutputFormat.

Return Values

Promise of a Blob object.

Availability

H5(Windows) H5(macOS) H5(Linux)
v19.3+ not supported not supported