ScanReader Class
class ScanReader : ScanningSdkLibrary.Instance
A loaded text-recognition engine, with its language data.
Loading is the expensive part, so create one reader and use it across the pages of a scan rather than one per page. Recognise with ScanPicture.read.
Holds the engine and its language data in native memory. Call close — or use Kotlin’s use { } — when done to release it immediately; an unclosed reader is only reclaimed when garbage collection happens to run. Confine an instance to one thread.
See also
Constructors
ScanReader
@JvmOverloads constructor(storage: File, languages: String, callback: ScanReader.ProgressCallback? = null, flags: EnumSet<ScanReader.Flag> = defaultFlags)
Creates a reader and loads the language data it needs.
@JvmOverloads constructor(storage: File, languages: List<String>, callback: ScanReader.ProgressCallback? = null, flags: EnumSet<ScanReader.Flag> = defaultFlags)
Creates a reader and loads the language data it needs.
Types
Companion
object Companion
Recognition defaults, and the flags a reader is created with.
DisplayCallback
interface DisplayCallback
Receives the image recognition actually ran on, so an application can show the user what the recogniser saw.
Flag
enum Flag : Enum<ScanReader.Flag>
Options controlling how recognised text is rendered into a string.
ProgressCallback
interface ProgressCallback
Receives progress while recognition runs, and can cancel it.
Functions
close
@Synchronized open override fun close()
Releases the native memory held by this instance immediately instead of waiting for the garbage collector.