Skip to content

Handling Sessions in Multipage Processing Mode

Use the below code snippet to interrupt the scanning processing after the page of the document is processed (for example, for showing a custom screen), and then start scanning of the next one:

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()
            }
        }
    }
}

Next Steps