Scanning Documents
Introduction
As seen in the previous section, the scan of a document can be performed after the API has been initialized and a scanning process has been started by calling the method:
MobbScanAPI.StartScan(documentType, operationMode, scanStartListener);
If the scanning process began successfully, the document scanning can be lauched by invoking the following method:
MobbScanAPI.ScanDocument(documentSide, scanId, documentDetectionListener, documentScanListener);
In the following sections these methods will be described in detail.
MobbScanAPI.StartScan
This method requests a new scanning process to be started. It takes three arguments:
documentType (XMobbScanDocumentType)
: Type of document that will be scanned. Check the supported document typesoperationMode (XMobbScanOperationMode)
: There are three supported values:ScanOnlyFront
: Use this value if you just need to scan the document front side.ScanOnlyBack
: Use this value if you just need to scan the document back side.ScanBothSides
: Use this value to scan both sides of the document.
NOTE: If a document with only one side will be scanned (like
PassportTD3
), the modeScanOnlyBack
should be used.scantStartListener (IXScanStartListener)
: A listener that is triggered when the scanning process is started. This listener will receive three arguments:result (XMobbScanStartScanResult)
: This value can takeOk
orError
values.scanId (string)
: Ifresult
isOk
, this parameter will contain the unique identifier for the whole scanning process.error (XMobbScanAPIError)
: Ifresult
isError
, this parameter will contain some info about the issue. Please, visit Error Handling section for further detail.
MobbScanAPI.ScanDocument
This method performs the detection and scanning of a document. It should be called once for each side of the document. The following arguments will be taken:
documentSide (XMobbScanDocumentSide)
: Side of the document that is being processed. EitherFront
orBack
value is expected.scanId (string)
: The unique identifier supplied in the previous step.documentDetectionListener (IXIdDocumentDetectionListener)
: A listener to be notified when the document detection gets done. The callback will provide you with:result (XMobbScanDetectionResult)
: This value can takeOk
orError
values.data (XMobbScanDetectionResultData)
: Ifresult
isOk
this struct will contain:documentSide (XMobbScanDocumentSide)
: Side of detected document.image (ImageSource)
: The captured image of the detected document.
error (XMobbScanAPIError)
: Ifresult
isError
, this parameter will contain some info about the issue. Please, visit Error Handling section for further detail.
documentScanListener (IXIdDocumentScanListener)
: The listener that will be called back when the scan process finishes. The arguments received are:result (XMobbScanScanResult)
: Possible values are:Completed
means the process has finished.PendingOtherSide
means that another call to theScanDocument
method is expected.Error
means something was wrong.
data (XMobbScanScanResultData)
: Ifresult
isOk
this struct will contain:documentSide (XMobbScanDocumentSide)
: Side of scanned document.idDocument (XIdDocument)
: It contains all the data extracted from the document. Know more about extracted fields and validations.
error (XMobbScanAPIError)
: Ifresult
isError
, this parameter will contain some info about the issue. Please, visit Error Handling section for further detail.