Forum Xamarin.Forms

VNDocumentCameraViewControllerDelegate How to get images back from Vision Kit

NodessNodess Member ✭✭✭
edited March 4 in Xamarin.Forms

am using Vision Kit in Xamarin Forms, so far I can take the picture but I am not sure how to actually save the picture or do any operation with it after.. Can you please advice how to access the picture? They use VNDocumentCameraViewControllerDelegate for any operation that will follow after the scanner, but I don't know where to get VNDocumentCameraScan scan

 public class ScannerRenderer : ViewRenderer<Scanner, UIView>
    {
        public VNDocumentCameraViewController scannerController;
        private ScannerDelegate del = new ScannerDelegate();
        protected override void OnElementChanged(ElementChangedEventArgs<Scanner> e)
        {
            base.OnElementChanged(e);

            if (this.Control != null) return;
            this.scannerController = new VNDocumentCameraViewController();
            this.SetNativeControl(this.scannerController.View); 
            // this.scannerController.Delegate = del.DidFinish();
            //documentCameraViewController(scannerController);
        }

        public void documentCameraViewController(VNDocumentCameraViewController scanner)
        {
            del.DidFinish(scanner);
        }
    }
}

 public class ScannerDelegate : VNDocumentCameraViewControllerDelegate
    {
        public override void DidFinish(VNDocumentCameraViewController controller, VNDocumentCameraScan scan)
        {

            base.DidFinish(controller, scan);

        }

        public override void DidCancel(VNDocumentCameraViewController controller)
        {
            base.DidCancel(controller);

        }

        public override void DidFail(VNDocumentCameraViewController controller, NSError error)
        {
            base.DidFail(controller, error);

        }
    }
Tagged:
Sign In or Register to comment.