@mateuszp/tesseract-wasm
Advanced tools
Comparing version 0.9.45 to 0.9.46
@@ -5,2 +5,2 @@ export { OcrWorker } from './ocr-worker'; | ||
export { createOCREngine, layoutFlags, supportsFastBuild } from './ocr-engine'; | ||
export type { CreateOCREngineOptions, BoxItem, IntRect, OCREngine, Orientation, ProgressListener, TextItem, TextUnit, Rectangle, } from './ocr-engine'; | ||
export type { CreateOCREngineOptions, BoxItem, IntRect, OCREngine, Orientation, TextItem, TextUnit, Rectangle, } from './ocr-engine'; |
@@ -45,6 +45,2 @@ /** | ||
/** | ||
* Handler that receives OCR operation progress updates. | ||
*/ | ||
export declare type ProgressListener = (progress: number) => void; | ||
/** | ||
* Image's rectangle to read text from. | ||
@@ -68,3 +64,2 @@ */ | ||
private _imageLoaded; | ||
private _progressChannel?; | ||
/** | ||
@@ -76,4 +71,2 @@ * Initialize the OCREngine. | ||
* @param tessLib - Emscripten entry point for the compiled WebAssembly module. | ||
* @param progressChannel - Channel used to report progress | ||
* updates when OCREngine is run on a background thread | ||
*/ | ||
@@ -146,3 +139,3 @@ constructor(tessLib: any, progressChannel?: MessagePort); | ||
*/ | ||
getTextBoxes(unit: TextUnit, onProgress?: ProgressListener): TextItem[]; | ||
getTextBoxes(unit: TextUnit): TextItem[]; | ||
/** | ||
@@ -155,3 +148,3 @@ * Perform layout analysis and text recognition on the current image, if | ||
*/ | ||
getText(onProgress?: ProgressListener): string; | ||
getText(): string; | ||
/** | ||
@@ -180,3 +173,2 @@ * Attempt to determine the orientation of the document image in degrees. | ||
wasmFallbackUrl?: string; | ||
progressChannel?: MessagePort; | ||
}; | ||
@@ -186,2 +178,2 @@ /** | ||
*/ | ||
export declare function createOCREngine({ wasmUrl, wasmFallbackUrl, progressChannel, }?: CreateOCREngineOptions): Promise<OCREngine>; | ||
export declare function createOCREngine({ wasmUrl, wasmFallbackUrl, }?: CreateOCREngineOptions): Promise<OCREngine>; |
@@ -1,2 +0,2 @@ | ||
import type { ProgressListener, Rectangle } from './ocr-engine'; | ||
import type { Rectangle } from './ocr-engine'; | ||
import type { OcrWorker } from './ocr-worker'; | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
recognizeText(image: ImageBitmap | ImageData, rectangle?: Rectangle, onProgress?: ProgressListener): Promise<string>; | ||
recognizeText(image: ImageBitmap | ImageData, rectangle?: Rectangle): Promise<string>; | ||
/** | ||
@@ -25,0 +25,0 @@ * Set the value of a Tesseract configuration variable. |
@@ -1,2 +0,2 @@ | ||
import type { BoxItem, Orientation, ProgressListener, Rectangle, TextItem, TextUnit } from './ocr-engine'; | ||
import type { BoxItem, Orientation, Rectangle, TextItem, TextUnit } from './ocr-engine'; | ||
export declare type OcrWorkerInit = { | ||
@@ -12,4 +12,4 @@ workerUrl?: string; | ||
getBoundingBoxes(unit: TextUnit): Promise<BoxItem[]>; | ||
getTextBoxes(unit: TextUnit, onProgress?: ProgressListener): Promise<TextItem[]>; | ||
getText(onProgress?: ProgressListener): Promise<string>; | ||
getTextBoxes(unit: TextUnit): Promise<TextItem[]>; | ||
getText(): Promise<string>; | ||
getVariable(name: string): Promise<string>; | ||
@@ -26,4 +26,2 @@ setVariable(name: string, value: string): Promise<void>; | ||
private _worker; | ||
private _progressListeners; | ||
private _progressChannel; | ||
private _ocrEngine; | ||
@@ -74,3 +72,3 @@ /** | ||
*/ | ||
getTextBoxes(unit: TextUnit, onProgress?: ProgressListener): Promise<TextItem[]>; | ||
getTextBoxes(unit: TextUnit): Promise<TextItem[]>; | ||
/** | ||
@@ -80,3 +78,3 @@ * Perform layout analysis and text recognition on the current image, if | ||
*/ | ||
getText(onProgress?: ProgressListener): Promise<string>; | ||
getText(): Promise<string>; | ||
/** | ||
@@ -108,4 +106,2 @@ * Get the value, represented as a string, of a Tesseract configuration variable. | ||
getOrientation(): Promise<Orientation>; | ||
private _addProgressListener; | ||
private _removeProgressListener; | ||
} |
import { CreateOCREngineOptions } from './ocr-engine'; | ||
export declare const workerAPI: { | ||
/** | ||
* @param progressChannel - Channel to send progress updates over. This is | ||
* sent separately from the options argument to enable comlink to transfer it. | ||
*/ | ||
createOCREngine: (options: CreateOCREngineOptions, progressChannel?: MessagePort) => Promise<import("./ocr-engine").OCREngine & import("comlink").ProxyMarked>; | ||
createOCREngine: (options: CreateOCREngineOptions) => Promise<import("./ocr-engine").OCREngine & import("comlink").ProxyMarked>; | ||
}; |
{ | ||
"name": "@mateuszp/tesseract-wasm", | ||
"version": "0.9.45", | ||
"version": "0.9.46", | ||
"description": "OCR library built on Tesseract", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
4846197
2655