OcrProvider


@ExperimentalPdfApi
interface OcrProvider : Closeable

Known direct subclasses
MlKitOcrProvider

Implementation of OcrProvider using ML Kit's Text Recognition.


Interface for processing images to recognize text.

Implementations should handle the complexity of OCR (Optical Character Recognition) processing and return a structured OcrResult that allows for spatial queries.

Summary

Public functions

Unit
suspend OcrResult?

Processes the given image and returns recognized text results.

Public functions

close

Added in 1.0.0-beta01
fun close(): Unit

recognizeText

suspend fun recognizeText(image: Bitmap): OcrResult?

Processes the given image and returns recognized text results.

Parameters
image: Bitmap

The bitmap to process for text recognition.

Returns
OcrResult?

An OcrResult containing the recognized text and its visual mapping, or null if no text was recognized or an error occurred.