performOcrOnPages

open fun performOcrOnPages(@NonNull pageIndexes: Set<Integer>, @NonNull ocrLanguage: OcrLanguage): PdfProcessorTask

Performs optical character recognition on the provided set of pages in the PDF document.

In order to use this feature, you need to include the PSPDFKit OCR dependencies in your framework. If using Gradle, you can add to your build.gradle file:


final String pspdfkit_version = {@value com.pspdfkit.PSPDFKit#VERSION};
dependencies {
    // Add the OCR component to your app.
    implementation "com.pspdfkit:pspdfkit-ocr:$pspdfkit_version"
    // Add one or multiple language packs for OCR.
    implementation "com.pspdfkit:pspdfkit-ocr-english:$pspdfkit_version"
}

NOTE: In order to use this, your license requires to have the OCR component enabled. Also, the language you pass in as a parameter needs to have a respective OCR language pack added to the dependencies. See OcrLanguage for a list of available languages.

For additional guidance on how to integrate and use OCR inside your app, please visit https://pspdfkit.com/guides/android/current/ocr/getting-started.

Return

This processor task for configuring processing steps.

Parameters

pageIndexes

Pages that should be used in OCR processing.

ocrLanguage

OcrLanguage for OCR processing.