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:

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