captureDocument()

Description

Captures a document.

Syntax

- (void) captureDocument

Parameters

None

Return value

void

Remarks

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

Circumstance Exception thrown
License verfication 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


@interface ViewController ()<DcsUIVideoViewDelegate>{
    DcsView *dcsView;
}
@end
 
@implementation ViewController
 
- (void)viewDidLoad {
    [super viewDidLoad];
     
    dcsView = [[DcsView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
 
    dcsView.videoView.delegate = self; 
    [self.view addSubview:dcsView];
    
    //Sets the capture mode to document mode.
    self.dcsView.videoView.mode = DME_DOCUMENT;
    [self.dcsView.videoView preview];
    [self.dcsView.videoView captureDocument];

}

- (BOOL) onPreCapture:(id)sender{
    //If NO is returned, the capture action will be cancelled.
    return YES;
} 

- (void) onPostCapture:(id)sender{
      
}

@end