static SBSDKUIWorkflow GermanIDCard() { SBSDKPageAspectRatio[] ratios = { new SBSDKPageAspectRatio(1.0, 0.6353) }; SBSDKUIWorkflowStep frontSide = new SBSDKUIScanMachineReadableZoneWorkflowStep( "German ID card 1/2", "Please scan the front of your id card.", ratios, true, (result) => { SBSDKMachineReadableZoneRecognizerResult mrz = result.MrzResult; if (mrz.RecognitionSuccessfull) { return(WorkflowError.ErrorWithCode(1, new NSString("This does not seem to be the front side."))); } return(null); } ); SBSDKUIWorkflowStep backSide = new SBSDKUIScanMachineReadableZoneWorkflowStep( "German ID card 2/2", "Please scan the back of your id card.", ratios, true, (result) => { SBSDKMachineReadableZoneRecognizerResult mrz = result.MrzResult; if (mrz == null || !mrz.RecognitionSuccessfull) { return(WorkflowError.ErrorWithCode(2, new NSString("This does not seem to be the back side."))); } if (mrz.DocumentType != SBSDKMachineReadableZoneRecognizerResultDocumentType.IDCard) { return(WorkflowError.ErrorWithCode(3, new NSString("This does not seem to be an ID card."))); } if (mrz.DocumentCodeField.Value.Length != 9 || !(mrz.IssuingStateOrOrganizationField.Value != "D")) { return(WorkflowError.ErrorWithCode(4, new NSString("This does not seem to be an ID card."))); } return(null); } ); SBSDKUIWorkflow workflow = new SBSDKUIWorkflow(new SBSDKUIWorkflowStep[] { frontSide, backSide }, "German ID card", null); return(workflow); }
static SBSDKUIWorkflow UkrainianPassport() { SBSDKUIWorkflowStep frontSide = new SBSDKUIWorkflowStep( "Ukrainian passport 1/1", "Please scan the front of your id card.", null, true, false, null, (result) => { SBSDKMachineReadableZoneRecognizer recognizer = new SBSDKMachineReadableZoneRecognizer(); SBSDKMachineReadableZoneRecognizerResult mrz = recognizer.RecognizePersonalIdentityFromImage(result.CapturedPage.DocumentImage); if (mrz == null || !mrz.RecognitionSuccessfull) { return(WorkflowError.ErrorWithCode(2, new NSString("This does not seem to be the correct page."))); } if (mrz.DocumentType != SBSDKMachineReadableZoneRecognizerResultDocumentType.Passport) { return(WorkflowError.ErrorWithCode(3, new NSString("This does not seem to be a passport."))); } if (mrz.DocumentCodeField.Value.Length != 8 || !(mrz.IssuingStateOrOrganizationField.Value != "UKR")) { return(WorkflowError.ErrorWithCode(4, new NSString("This does not seem to be a ukrainian passport."))); } return(null); } ); SBSDKUIWorkflow workflow = new SBSDKUIWorkflow(new SBSDKUIWorkflowStep[] { frontSide }, "Ukrainian passport", null); return(workflow); }
public override void DidDetect( SBSDKUIMRZScannerViewController viewController, SBSDKMachineReadableZoneRecognizerResult zone) { ShowPopup(viewController, zone.StringRepresentation); }