startTextCapture method
Opens a modal dialog with controls for the Text Capture scenario.
AbbyyRtrSdk.startTextCapture(callback, options)
Parameters
- callback
- The callback function which receives the text capture operation result. Your callback should expect a single JSON object as an argument (see Result).
- options
- JSON object specifying text capture parameters (see Options).
Options
The table below describes the JSON object that you can pass as the options argument to change text 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". |
selectableRecognitionLanguages | string array |
Recognition languages which can be selected by the user, for example: ["English", "French", "German"]. Empty array disables language selection. Note: For the list of supported languages and their identifiers, see Specifications — Available Languages in the ABBYY Mobile Capture SDK Developer's Guide. Default: [] (empty array, language selection disabled). |
recognitionLanguages | string array |
Recognition language selected by default. Default: ["English"]. |
areaOfInterest | string |
Width and height of the recognition area, separated by a whitespace — for example: "0.8 0.3". The area of interest is centered in the preview frame, its width and height are relative to the preview frame size and should be in the [0.0, 1.0] range. Default: "0.8 0.3" (intended to capture a few lines of text in portrait mode). |
orientation | string |
The type of image orientation. This key can be set to the following values:
Default: "default". |
stopWhenStable | boolean |
Whether to stop the plugin as soon as the result status is "Stable" (see Result status). When enabled (true), the recognition process can be stopped automatically. When disabled (false), recognition can be stopped only manually by user. Default: true (automatic stop enabled). |
isFlashlightVisible | boolean |
Show (true) or hide (false) the flashlight button in the text capture dialog. Default: true (flashlight available). |
isStopButtonVisible | boolean |
Show (true) or hide (false) the stop button in the text capture dialog. When the user taps stop, Mobile Capture SDK returns the latest recognition result. Default: true (manual stop available). |
Result
This section describes the JSON object that represents text recognition results. The callback you implement should parse this object and show results to user.
Key | Value type | Description |
---|---|---|
textLines | object array |
An array of objects representing recognized lines of text. These objects have the following keys:
If an error occurs during processing, the textLines key is not present in the result. |
resultInfo | object |
Additional information. This object has the following keys:
|
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 text capture succeeds.
{
textLines : [
{
text : "Welcome to ABBYY Mobile Capture SDK",
"quadrangle": [
{
"x": 82,
"y": 567
},
{
"x": 82,
"y": 567
},
{
"x": 82,
"y": 567
},
{
"x": 82,
"y": 567
}
],
"rect": {
"top": 515,
"bottom": 568,
"left": 82,
"right": 528
},
} ],
resultInfo : {
stabilityStatus : "Available",
userAction : "Manually Stopped",
frameSize : "720 1280",
recognitionLanguages : ["English", "French"]
}
}
On error, you will receive a JSON which does not contain recognized text but provides an error message.
{
error : {
description : "Something has gone wrong."
},
resultInfo : {
stabilityStatus : "Tentative",
userAction : "Canceled",
frameSize : "720 1280",
recognitionLanguages : ["English", "French"]
}
}
3/2/2022 12:59:15 PM