captureDocument()

Description

Captures a document.

Syntax

func captureDocument()

Parameters

None

Return value

Void

Remarks

If the function is executed asynchronously, it will first trigger the event onPreCapture, then the capture operation, and finally, trigger the event onPostCapture. Before the event onPostCapture is triggered, the captured document will be added to the current DcsView buffer.

Make sure the current camera is open before calling this method. You can open the camera via preview method.

Exceptions

onCaptureFailure is fired under the following circumstances to receive exceptions.

Circumstance Exception
License verification failed. DcsLicenseVerificationFailedException
The capture mode is not DME_DOCUMENT. DcsOnlySupportedUnderDocumentModeException
The access to the camera is not authorized. DcsCameraNotAuthorizedException
The current camera is not open. DcsOperationSequenceExeption

Example

class ViewController: UIViewController{
    var dcsView:DcsView!
    override func viewDidLoad() {
        super.viewDidLoad()
        dcsView = DcsView(frame: CGRect(x:0,y:0,width:self.view.frame.size.width,height:self.view.frame.size.height))
        view.addSubview(dcsView)
        dcsView.currentView = DVE_VIDEOVIEW
        dcsView.videoView.mode = DME_DOCUMENT

        var captureButton = UIButton(frame:CGRect(x:self.view.center.x-100, y:self.view.center.y-20, width: 200, height: 40))
        captureButton.setTitle("Capture document", for: .normal)
        captureButton.setTitleColor(UIColor.blue, for: .highlighted)
        captureButton.addTarget(self, action: #selector(captureDocument), for: .touchUpInside)
        dcsView.videoView.addSubview(captureButton)  
    }
    func captureDocument()
    {
        dcsView.videoView.captureDocument()
    }
}
Is this page helpful?

Leave a Reply

Your email address will not be published.