ScanLayout Class
class ScanLayout : ScanningSdkLibrary.Instance
The structure recognition found on a page: the regions of text, and how they nest.
Describes where the recogniser believes blocks, lines, and words sit, which is what lets an application highlight a word the user taps or reflow the text it displays.
Holds its layout in native memory. Call close — or use Kotlin’s use { } — when done to release it immediately; an unclosed instance is only reclaimed when garbage collection happens to run. Confine an instance to one thread, as with every SDK native handle.
See also
Constructors
ScanLayout
constructor(bytes: ByteArray)
Restores a layout previously serialised by writeBytes.
Types
Tag
class Tag(val id: Int, val level: Int, val text: String?, val rect: RectF?) : Comparable<ScanLayout.Tag>
Identifies one recognised text item, so a region of the layout can be matched to the text it produced in ScanText.
Functions
close
@Synchronized open override fun close()
Releases the native memory held by this instance immediately instead of waiting for the garbage collector.
getInwardBounds
external fun getInwardBounds(tags: Array<ScanLayout.Tag>): RectF?
Returns the smallest rectangle enclosing the innermost tags of a set.
hasOwner
external fun hasOwner(tag: ScanLayout.Tag): Boolean
Whether a tag sits inside another one — a word within a line, or a line within a block.
writeBytes
external fun writeBytes(packed: Boolean): ByteArray
Serialises this layout so it can be stored or passed between processes.