Code samples

This page contains useful use-cases of Document Reader SDK

Handling sessions in the multipage processing mode

The code snippet below demonstrates how to interrupt the scanning processing after the page of the document is processed (e.g. for showing a custom screen), and then start scanning of the next one:

Kotlin
Kotlin
override fun onResume() {
super.onResume()
// set setManualMultipageMode to true and multipageProcessing to false
DocumentReader.Instance().functionality().edit().setManualMultipageMode(true).apply()
DocumentReader.Instance().processParams().multipageProcessing = false
DocumentReader.Instance().startNewSession()
showScanner()
}
‚Äč
private fun showScanner() {
DocumentReader.Instance().showScanner(this@MainActivity) { action, results, error ->
if (action == DocReaderAction.COMPLETE) {
if (results.morePagesAvailable != 0) {
DocumentReader.Instance().startNewPage()
showScanner()
}
}
}
}