ProgressCallback Interface

interface ProgressCallback

Receives progress while recognition runs, and can cancel it.

The SDK calls these methods from the thread running recognition, not from the main thread, so update your UI by posting rather than touching views directly. Keep the work inside them short: recognition is blocked while a callback runs.

Throwing is supported and defined. If a callback throws, recognition is cancelled, your exception reaches the ScanPicture.read caller unchanged, and the reader stays usable for the next page.

Functions

onCancel

open fun onCancel(page: Int, words: Int): Boolean

Asked periodically whether recognition should stop.

onProgress

open fun onProgress(page: Int, progress: Int, box: RectF?)

Reports how far recognition has got, for driving a progress indicator.

Top