> For the complete documentation index, see [llms.txt](https://regulaforensics.gitbook.io/android/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://regulaforensics.gitbook.io/android/5.6-5/code-samples.md).

# 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:

{% tabs %}
{% tab title="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()
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}
