Getting started
Requirements
Before you start using the Document Detector SDK, you will need to have the following:
A valid Caf access token to authenticate the SDK (check this documentation for more information).
A HTML file with a
<body>
tag. The SDK will render the document detection UI in this tag.
Importing the SDK
Download the
.umd.js
file: document-detector-6.2.0.umd.jsDownload the
.wasm
file: dd-validator.wasmPlace both files in the same directory (e.g.
public/sdks/caf-dd/
).Import the
.umd.js
file in your HTML file. For example (assuming apublic/index.html
file):
Import the SDK as a JavaScript module in a script tag:
Construction and usage
To use the Document Detector SDK, you will need to create an instance of the DocumentDetector class. This class will allow you to initialize the SDK, capture documents, and close the SDK. You can also pass options to the SDK to customize its behavior.
In the builder, the SDK receives a single parameter with the settings:
This parameter is an object containing the configuration options for the SDK. These options customize the behavior of the SDK according to your application's requirements. The following table lists the available options:
Parameter
Type
Required?
Default Value
token
Authentication token for consuming the SDK.
String
Yes.
-
language
Default message language, valid values: en_US, en_BR, es_MX.
String
No.
pt_BR
blockExecutionOnDesktops
Flag indicating whether execution on desktops should be blocked or not
boolean
No.
false
enableVisibilityChangeSecurity
Enables the security enhancement responsible for closing the SDK when the user switches browser tabs.
boolean
No.
false
analytics
Specifies the analytics settings for the SDK. This parameter allows you to configure analytics tracking within the SDK.
Object
No.
appearance
Specifies the appearance settings for the SDK user interface (UI). This parameter allows you to customize the visual appearance of the SDK components to match the look and feel of your application.
Object
No.
messages
Customizes displayed messages within the SDK to optimize user experience.
Object
No.
Example
index.html
index.js
For more information on the SDK's methods and properties, check the SDK methods documentation.
Last updated