startImageCapture method of AbbyyRtrSdk module
Opens a modal dialog with controls for the Image Capture scenario.
AbbyyRtrSdk.startImageCapture(callback, options)
Parameters
- callback
- The callback function which receives the image capture operation result. Your callback should expect a single JSON object as an argument (see Result).
- options
- JSON object specifying image capture parameters (see Options).
Options
The table below describes the JSON object that you can pass as the options argument to change image capture settings. All keys are optional. Omitting a key means that a default setting will be used.
Key | Value type | Description |
---|---|---|
licenseFileName | string |
The name of the license file. This file must be located in the www/rtr_assets/ directory in your project. Default: "AbbyyRtrSdk.license". |
cameraResolution | string |
The resolution of the images captured from the camera preview. This key can be set to the following values:
Default: "FullHD". |
isFlashlightButtonVisible | boolean |
Show (true) or hide (false) the flashlight button in the image capture dialog. Default: true (flashlight visible). |
isCaptureButtonVisible | boolean |
Show (true) or hide (false) the button for taking photo manually. Default: false (button is hidden). |
isGalleryButtonVisible | boolean |
Show (true) or hide (false) the button for choosing an image from photo gallery. Default: true (flashlight visible). |
orientation | string |
The type of image orientation. This key can be set to the following values:
Default: "default". |
destination | string |
Captured image will be saved to corresponding file ("file") or returned as encode base64 image string ("base64"). Note: If more than 1 image is captured, this option value will be ignored and the images will be saved to files anyway. Default: "file". |
exportType | string |
Captured image will be saved to this format. This key can be set to the following values:
Default: "jpg". |
showPreview | boolean |
Show image preview after capture (true) or wait until the number of captured images is equal to the requiredPageCount (false). Default: false. |
requiredPageCount | int |
Total number of pages to be captured. Set the page-limitation mode of the image capture as following:
Default: 0. |
compressionLevel | string |
The uniform image compression scale for lossy formats. This key can be set to the following values:
Default: "Low". |
defaultImageSettings | object |
Custom image capture settings. This object has the following keys:
or defined as a string with 2 integers separated with a whitespace: "54 86". All keys are optional. |
Result
This section describes the JSON object that represents image capture results. The callback you implement should parse this object and show results to user.
Key | Value type | Description |
---|---|---|
images | object array |
Captured images. This parameter is returned only if the exportType is set to "jpg" or "png".
|
pdfInfo | object |
This parameter is returned if the exportType is set to "pdf". The value is an object which has the following parameters:
|
resultInfo | object |
Additional information. This object has the following parameters:
|
error | object |
Error details. This key is present only if an error occurs. The value is an object which has a single key:
|
Below is an example of a result JSON when image capture succeeds.
{
"images":[
{
"resultInfo":{
"exportType":"jpg"
},
"filePath":"/private/var/mobile/Containers/Data/Application/ХХХХХХХХ-ХХХХ-ХХХХ-ХХХХ-ХХХХХХХХХХХХ/tmp/1562917370501.jpg"
}
],
"resultInfo":{
"userAction":"Manually Stopped"
},
"pdfInfo":{
"compressionLevel":"Normal",
"pdfCompressionType":"jpg",
"pagesCount":1,
"filePath":"/private/var/mobile/Containers/Data/Application/ХХХХХХХХ-ХХХХ-ХХХХ-ХХХХ-ХХХХХХХХХХХХ/tmp/ImageCapture - 2019-07-12 10_42_57.pdf"
}
}
On error, you will receive a JSON which does not contain image capture result but provides an error message.
{
"error":
{
"description":"Unacceptable license information is used or the functionality is not available under the license."
}
}
02.03.2022 12:59:15