iOS 13 - VNDocumentCameraViewController maximum number of Scans

3.3k Views Asked by At

Exporing the new VNDocumentCameraViewController I cannot find any delegate or property to set the maximum number of scans.

Does anybody have a workaround or any idea I can implement to limit the number of scans in one go?

3

There are 3 best solutions below

0
On

As of iOS 13 Apple doesn't currently support limiting the scan count.

See VNDocumentCameraViewController for the documentation for the class. The delegate VNDocumentCameraViewControllerDelegate doesn't have anything either.

If you want to use the native scanner your best bet is just picking the first scan once documentCameraViewController(_:didFinishWith:) is called.

Alternatively, you can have a look at WeScan.

2
On

I had the same issue, and I'm trying other alternatives. It's limited to 24 scans top. By default and it's not customizable

1
On

All you can do is call VNDocumentCameraViewControllerDelegate and add this delegate method:

func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {
    // Process the scanned pages
    for pageNumber in 0..<scan.pageCount {

    }

    // You are responsible for dismissing the controller.
    controller.dismiss(animated: true)
}

In for loop you can add you limit and if the limit exceed you can stop scanning.