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() {
let config = DocReader.ScannerConfig()
config.scenario = RGL_SCENARIO_FULL_PROCESS
DocReader.shared.showScanner(presenter: self, config: config) { (action, result, error) in
if action == .complete {
guard let results = results else {
return
}
if results.morePagesAvailable != 0 {
DocReader.shared.startNewPage()
self.showScanner()
}
}
}
}
- (void)viewDidLoad {
[super viewDidLoad];
RGLDocReader.shared.functionality.manualMultipageMode = YES;
RGLDocReader.shared.processParams.multipageProcessing = @NO;
[RGLDocReader.shared startNewSession];
[self showScanner];
}
- (void)showScanner {
RGLScannerConfig *config = [[RGLScannerConfig alloc] init];
config.scenario = RGL_SCENARIO_FULL_PROCESS;
[RGLDocReader.shared showScannerFromPresenter:self config:config completion:^(enum RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
if (action != RGLDocReaderActionComplete) {
return;
}
if (results == nil) {
return;
}
if (results.morePagesAvailable != 0) {
[RGLDocReader.shared startNewPage];
[self showScanner];
}
}];
}