Settings and Attributes
There are two ways to define the element's settings:
- via the
settings
property of the JavaScript object, - via attributes of the corresponding HTML tag.
See the description and examples below.
- Using
settings
property to configure element:
const element = document.createElement('document-reader');
element.settings = {
startScreen: true,
internalScenario: 'Locate',
multipageProcessing: true,
};
- Using attributes to configure element:
<document-reader start-screen internal-scenario="Locate"></document-reader>
We highly recommend using the settings
property of the element to configure its parameters.
This method gives more flexibility in setup, in addition, all new configuration parameters in the future will be available only as the settings of the object (not as HTML attributes).
Settings and Attributes Description
See all component settings and attributes in the following table.
Setting name | Attribute name | Description | Type | Default | Values | Related components |
---|---|---|---|---|---|---|
internalScenario |
internal-scenario |
The component document verification scenario. | string | - | MrzAndLocate , MrzOrLocate , Mrz , Locate , Barcode , MrzOrBarcode , BarcodeAndLocate |
document-reader |
multipageProcessing |
multipage-processing |
Whether to allow processing of two pages in cases when the component detects an ID1-sized document. Multipage processing is not triggered for documents of other formats. If true , the component asks for the second page and processes it. If false , only one page/side of the document is processed regardless the document format. |
boolean | false |
true , false |
document-reader |
startScreen |
start-screen |
Whether to show the start screen with two options for the document image uploading: From camera and From gallery. If true , the start screen is shown. If false , no start screen is shown and instead the camera of the device is turned on automatically to capture the image of the document. |
boolean | false |
true , false |
document-reader , camera-snapshot |
multipleFileInput |
multiple |
Whether to allow uploading more than one file via the file system. Can be set to true only if startScreen is true . |
boolean | true |
true , false |
document-reader , camera-snapshot |
cameraId |
camera-id |
Ability to select a camera. You can get the device ID using navigator.mediaDevices.enumerateDevices(). | string | undefined |
camera id string value |
document-reader , camera-snapshot |
devLicense |
license |
To use the component on test environments, set the Base64 license value to the license attribute. |
string | undefined |
base64 license value |
document-reader |
captureMode |
— | Sets the capture mode. Mode auto - recognition starts immediately after the camera starts working. Mode captureFrame - recognition of the frame received after pressing the capture button. Mode captureVideo - recognition begins after pressing the button, pressing the button again will send the received frame for processing. |
string | auto |
auto , captureVideo , captureFrame |
document-reader |
resolution |
— | Sets the resolution of the video stream from the camera. | object | { width: 1920, height: 1080 } |
{ width: number, height: number } |
document-reader , camera-snapshot |
cameraMode |
— | Selects the front or rear camera of the device. | object | environment |
environment , user |
document-reader , camera-snapshot |
nonce |
— | Sets the unique nonce value to maintain the CSP policy. | string | undefined |
unique nonce value |
document-reader , camera-snapshot |
videoRecord |
— | Sets the ability to record a video of the document scanning process. If set to true it records the entire process. You can also set the recording delay and recording duration. The video will be available in the component response. | boolean or object | undefined |
true , false , { delay: number, duration: number, bitrate: number } |
document-reader |
videoCaptureMotionControl |
— | Enables device shaking control. | boolean | false |
true , false |
document-reader |
mirrorType |
— | Sets the initial value of video mirroring. | string | mirror - for front camera, noMirror - for back camera, |
mirror , noMirror |
document-reader , camera-snapshot |
mobileDelegate |
— | Changes the success screen in case of delegating scanning via a mobile device. | boolean | false |
true , false |
document-reader |