Show scanner

After initialization is completed and the scenario is set, you can start document scanning process:

// starting video processing
DocumentReader.Instance().showScanner(new DocumentReader.DocumentReaderCompletion() {
    @Override
    public void onCompleted(int action, DocumentReaderResults results, String error) {
        // processing is finished, all results are ready
        if (action == DocReaderAction.COMPLETE) { 
            // scanning process was finished
        }                
    } else {
        // something happened before all results were ready
        if (action == DocReaderAction.CANCEL){
            Toast.makeText(MainActivity.this, "Scanning was cancelled",Toast.LENGTH_LONG).show();
        } else if(action == DocReaderAction.ERROR){
            Toast.makeText(MainActivity.this, "Error:" + error, Toast.LENGTH_LONG).show();
        }
    }
});

The current result is returned in the completion block from each camera shot with different actions (DocReaderAction enum) during the scanning process:

  • complete - scanning process was finished

  • process - scanning process is not finished, you can get an intermediate result from the completion block

  • cancel - scanning process was canceled by the user

Last updated