Skip to content

Code Samples

On this page, we will collect handy use cases of Document Reader SDK.

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 func viewDidLoad() {
    super.viewDidLoad()

    DocReader.shared.functionality.manualMultipageMode = true
    DocReader.shared.processParams.multipageProcessing = false

    DocReader.shared.startNewSession()
    showScanner()
}

func showScanner() {
    DocReader.shared.showScanner(self) { (action, results, error) in
        if action == .complete {
            guard let results = results else {
                return
            }

            if results.morePagesAvailable != 0 {
                DocReader.shared.startNewPage()
                self.showScanner()
            }
        }
    }
}
Back to top