Incorrect result or user canceled the action error in ionic document-scanner plugin

I am using document scanner plugin to scan a document. But after capturing the image, I am getting “Incorrect result or user canceled the action” error.

My Code:

import { DocumentScanner, DocumentScannerOptions } from ‘@ionic-native/document-scanner/ngx’;

getScanResult() {

this.platform.ready().then((readySource) => {

  let opts: DocumentScannerOptions = {
    sourceType: 1,
    quality: 2.5,
    returnBase64: true
  };

  this.documentScanner.scanDoc(opts)
    .then((res: string) => {
      console.log(res)
      this.text = res;
      this.data = res;
    })
    .catch((error: any) => {
      console.error(error);
      this.text = error;
    });


 });