Skip to content

Multipage Processing

If the multipage processing is enabled, the SDK processes the front side of the document, recognizes the document type and checks in the database how many pages should be available for this document type. If there are any child documents (second page, back side) for this document type, the multipage processing is triggered. This concerns scenarios that recognize document types.

The exceptions are the MRZ and Locate and Locate scenarios. In this case, if the SDK detects an ID1-sized document, it asks for the second page. The multipage processing is not triggered for documents of other formats.

  • To process more than one page of a document for several iterations, use:
DocReader.shared.processParams.multipageProcessing = true
[RGLDocReader shared].processParams.multipageProcessing = @YES;
DocumentReader.Instance().processParams().multipageProcessing = true
DocumentReader.Instance().processParams().multipageProcessing = true;
DocumentReader.instance.processParams.multipageProcessing = true;
DocumentReader.setProcessParams({
    multipageProcessing: true,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setProcessParams({
    multipageProcessing: true
});
DocumentReader.setProcessParams({
    multipageProcessing: true,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().ProcessParams().MultipageProcessing = (Java.Lang.Boolean)true;

// iOS
RGLDocReader.Shared.ProcessParams.MultipageProcessing = true;
  • To process up to two pages of the document (a so-called "double-page spread") in one shot if they are presented on the frame (image), use:
DocReader.shared.processParams.doublePageSpread = true
[RGLDocReader shared].processParams.doublePageSpread = @YES;
DocumentReader.Instance().processParams().doublePageSpread = true
DocumentReader.Instance().processParams().doublePageSpread = true;
DocumentReader.instance.processParams.doublePageSpread = true;
DocumentReader.setProcessParams({
    doublePageSpread: true,
}, (str) => { console.log(str) }, (error) => { console.log(error) });
DocumentReader.setProcessParams({
    doublePageSpread: true
});
DocumentReader.setProcessParams({
    doublePageSpread: true,
}, function (m) { }, function (e) { console.log(e); });
// Android
DocumentReader.Instance().ProcessParams().DoublePageSpread = (Java.Lang.Boolean)true;

// iOS
RGLDocReader.Shared.ProcessParams.DoublePageSpread = true;

Info

This option is available for the following scenarios only: Document Type, Visual OCR, Full Processing, MRZ or Visual OCR or Barcode, MRZ or Visual OCR, MRZ or Visual OCR (with Graphics).

  • 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];
        }
    }];
}
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() {
    val scannerConfig = ScannerConfig.Builder(Scenario.SCENARIO_FULL_PROCESS).build()
    DocumentReader.Instance().showScanner(this@MainActivity, scannerConfig, completion)

    private val completion = IDocumentReaderCompletion { action, results, error ->
        if (action == DocReaderAction.COMPLETE) {
            if (results.morePagesAvailable != 0) {
                DocumentReader.Instance().startNewPage()
                showScanner()
            }
        }
    }
}
init() {
  DocumentReader.instance.functionality.manualMultipageMode = true;
  DocumentReader.instance.processParams.multipageProcessing = false;

  DocumentReader.instance.startNewSession();
  showScanner();
}

showScanner() {
  var config = ScannerConfig.withScenario(Scenario.FULL_PROCESS);
  DocumentReader.instance.scan(config, (action, results, error) {
    if (action == DocReaderAction.COMPLETE) {
      if (results!.morePagesAvailable != 0) {
        DocumentReader.instance.startNewPage();
        showScanner();
      }
    }
  });
}
DocumentReader.setFunctionality({"manualMultipageMode": true}, _ => { }, _ => { })
DocumentReader.setProcessParams({"multipageProcessing": false}, _ => { }, _ => { })

DocumentReader.startNewSession(_ => { }, _ => { });

var config = new ScannerConfig();
config.scenario = Enum.ScenarioIdentifier.SCENARIO_FULL_PROCESS;
DocumentReader.scan(config, _ => { }, _ => { });
DocumentReader.setFunctionality({"manualMultipageMode": true})
DocumentReader.setProcessParams({"multipageProcessing": false})

DocumentReader.startNewSession();

var config = new ScannerConfig();
config.scenario = Enum.ScenarioIdentifier.SCENARIO_FULL_PROCESS;
DocumentReader.scan(config);
DocumentReader.setFunctionality({"manualMultipageMode": true}, function (m) { }, function (e) { })
DocumentReader.setProcessParams({"multipageProcessing": false}, function (m) { }, function (e) { })

DocumentReader.startNewSession(function (m) { }, function (e) { });

var config = new ScannerConfig();
config.scenario = Enum.ScenarioIdentifier.SCENARIO_FULL_PROCESS;
DocumentReader.scan(config, function (m) { }, function (e) { });
// Android
public class MainActivity : MauiAppCompatActivity, IDocumentReaderCompletion
{
    protected override void OnCreate(Bundle bundle)
    {
        DocumentReader.Instance().Functionality().Edit().SetManualMultipageMode(true).Apply();
        DocumentReader.Instance().ProcessParams().MultipageProcessing = (Java.Lang.Boolean)false;


        DocumentReader.Instance().StartNewSession();
        ShowScanner();
    }

    public void ShowScanner()
    {
        ScannerConfig scannerConfig = new ScannerConfig.Builder(Scenario.ScenarioFullProcess).Build();
        DocumentReader.Instance().ShowScanner(this, scannerConfig, this);
    }

    public void OnCompleted(int action, DocumentReaderResults results, DocumentReaderException error)
    {
        if (action == DocReaderAction.Complete && results.MorePagesAvailable != 0)
        {
            DocumentReader.Instance().StartNewPage();
            ShowScanner();
        }
    }
}

// iOS
public void Main()
{
    RGLDocReader.Shared.Functionality.ManualMultipageMode = true;
    RGLDocReader.Shared.ProcessParams.MultipageProcessing = false;

    RGLDocReader.Shared.StartNewSession();
    ShowScanner();
}

public void ShowScanner()
{
    RGLScannerConfig config = new()
    {
        Scenario = Constants.RGL_SCENARIO_FULL_PROCESS
    };
    RGLDocReader.Shared.ShowScannerFromPresenter(this, config, OnResultsObtained);
}

private void OnResultsObtained(RGLDocReaderAction action, RGLDocumentReaderResults result, NSError error)
{
    if (action == RGLDocReaderAction.Complete && result.MorePagesAvailable != 0) {
        RGLDocReader.Shared.StartNewPage();
        ShowScanner();
    }
}

Next Steps