DocumentDetector v8.x or below
Supported documents
Currently, the documents supported on iOS are:
Required permissions
In the info.plist
file, add the permissions below:
Permission | Reason | Required? |
| To capture the document photo(s) | No, only required in camera capture stream |
| To perform the gallery opening. | No, required only in the upload stream |
NSPhotoLibraryUsageDescription
Utilization
First, instantiate an object of type DocumentDetectorSdk
:
DocumentDetectorSdk.Builder
Parameter | Required? |
Usage token associated with your CAF account | Yes |
Sets the document capture flow, as explained here | Yes |
Identifier of the user for the purpose of identifying a fraudulent profile | No, only used for analytics |
Enables/disables data collection for analytics | No, the default is |
Change the setting of the inflated popups before each document | No, the default is |
Changes the default document detection setting, the frame confidence threshold (from 0.0 to 1.0, where 1.0 indicates that the SDK will only accept the document with a perfect frame) | No. The default is 0.91 |
Changes the default setting for verifying the quality of the captures, indicating whether you want to perform this verification (takes about 2 seconds) and the quality threshold for these photos can be set (value from 1.0 to 5.0). In addition, the SDK will return the URL of the image in the variable | No. The default is true and 1.8, respectively |
Changes the document masks from success, failure, and normal. It also allows you to change the sound and cancel buttons at the top of the screen. See the example. | No |
Change the color of the sound and cancel buttons that are at the top of the screen. Also change the color of the popup buttons, inflated before each document. | No |
Enables/disables sounds and the sound icon in the SDK | No, the default is |
Show/hide the lower middle label (which contains the document name) | No, the default is |
Show/hide the central label (which contains the status) | No, the default is |
Change the default network settings | No. The default is 60 (seconds) |
Defines threshold between acceptable/unacceptable ambient brightness. The threshold of this sensor is a number ranging from negative to positive. | No. The default setting is -3. |
Defines threshold between correct/incorrect device orientation. Higher the value more flexible it will be. The threshold of this sensor is the acceleration of the device | No. The default setting is 0.3. |
Changes the default settings of the stability sensor. The threshold of this sensor is in the range of the last two accelerations collected from the device. | No. The default setting is 0.3. |
Sets the proxy settings, as explained here | No. The default is |
Enables/disables the capture preview. If | No. The default is |
Allows customizing messages displayed in the "status" balloon during the capture and analysis process. example | No. |
Allows you to set the quality in the compression process. By default, all captures are compressed. The method expects values between 0 and 1.0 as parameters, 1.0 being the best quality compression (recommended). | No. The default is 1.0 |
Enables/disables manual capture. The time parameter sets the | No. The default is disabled |
Enables/disables multi-language support. | No. The default is enabled |
Sets how long the image URL will last on the server until it is expired. Expect to receive a time interval between "30m" to "30d". Examples:
| No. The default is |
Sets the type of mask used in the captures. There are three types:
| No. The default is |
Delay the activity after the completion of each step. This method can be used to display a success message on the screen itself after the capture, for example. | No. The default is |
Sets the settings for uploading documents. By enabling this option, the SDK flow will prompt the user to upload the document files instead of capturing them with the device's camera. This option also includes document quality checks. example of implementation. | No. By default this option is disabled. |
Allows you to set the capture resolution. The method takes a parameter a Resolution, which has the following options:
| No. The default is |
Enables the option to allow passports from only a certain issuing country, or, a list of countries. See the complete list at: ISO 3166-1 alpha-3 Example:
| No. Passports issued by any country are accepted by default. |
DocumentDetectorStep
To create a capture flow, you will need to create an array of DocumentDetectorStep
, where each element will be a capture step. To construct each DocumentDetectorStep
object, you can enter the following elements:
Parameter | Required? |
document: Document Identifies which document you want to capture in the respective step | Yes |
stepLabel: String? Text to be displayed at the bottom of the layout | No. There is a pattern per |
illustration: UIImage? Illustration to be shown in the popup before the capture | No. There is a pattern per |
audio: URL? Audio to be played at the beginning of the step. Example. | No. There is a pattern per |
MessageSettings
Attribute | Default Value |
Message displayed when SDK is in the process of opening. | "Please Wait…" |
Message advising to fit the document to the mask. | "Fit the document on the markup" |
Message displayed when the SDK makes a request to the backend, verifying quality. | "Checking Quality…" |
Message displayed when the quality of the capture fails. | "Ops, could not read the information. Please try again" |
Message displayed when there is no quality check and the capture is being saved on the servers. | "Sending Image…" |
Text displayed in the step initialization popup. | "Dispose the document in a desk, centralize it on the markup and hold the automatic capture." |
Message displayed when a unexpected type of document is displayed for capture. | "Ops, it seems that this document is not supported. Contact us!" |
Message displayed when the front of the RG(Brazilian ID card) is displayed in a different flow than expected. | "Ops, this is the RG's Front" |
Message displayed when the RG(Brazilian ID card) version is displayed in a different flow than expected. | "Ops, this is the RG's Back" |
Message displayed when the open RG(Brazilian ID card) is displayed in a different stream than expected. | "Ops, this is the RG Opened" |
Message displayed when the front of the CNH(Brazilian driver's license) is displayed in a different stream than expected. | "Ops, this is the CNH's Front" |
Message displayed when the version of the CNH(Brazilian driver's license) is displayed in a different stream than expected. | "Ops, this is the CNH's Back" |
Message displayed when the open CNH(Brazilian driver's license) is displayed in a different stream than expected. | "Ops, this is the CNH Opened" |
Message displayed when the CRLV(Brazilian Vehicle Registration and Licensing Certificate) is displayed in a different stream than expected. | "Ops, this is the CRLV" |
Message displayed when the front of the RNE(National Registry of Foreigners) is displayed in a different stream than expected. | "Ops, this is the RNE's Front" |
Message displayed when the back of the RNE(National Registry of Foreigners) is displayed in a different stream than expected. | "Ops, this is the RNE's Back" |
Message displayed when the brightness threshold is lower than expected. | "Area near you is too dark" |
Message displayed when the orientation threshold is lower than expected. | "The device is not on the horizontal" |
Message displayed when the orientation threshold is lower than expected. | "Keep the device still" |
UploadSettings
To activate the document upload functionality it is necessary to instantiate an object of type UploadSettings
() and set its parameters:
Parameter | Required? |
Enables/disables this feature. | No. The default is |
Enables/disables file compression before uploading. | No. The default is |
Defines the file format(s) that will be accepted for upload. | No. By default .PDF , .JPEG and .PNG are accepted |
Sets the maximum KB limit of the file to upload. | No. The default limit is 10000 KB (10MB). |
Currently, the supported file formats are:
Getting the result
To get the result, you must implement the DocumentDetectorControllerDelegate
delegate in your controller:
After creating the DocumentDetector
object, start the DocumentDetectorController
by passing this object as a parameter in the constructor:
DocumentDetectorResult
Parameter | Can it be null? |
The array with the respective captures of the parameterized documents | Yes, in case of error |
type: String The class of the read document stream. This parameter is useful in an integration with our OCR route. The existing types are: | Yes, in case of error |
trackingId: String? Identifier of this run on our servers. If possible, save this field and send it along to our API. This way we will have more data about how the user behaved during the execution | Yes, if the user sets |
Capture
Parameter | Can it be null? |
Document image | No |
URL of the document on CAF's server. If you want this URL, keep enabled the parameter that checks the image quality | Yes, if you choose not to check the image quality |
Label of the respective document within the following possibilities: | No |
Quality inferred by the document quality algorithm, when enabled. Varies between 1.0 and 5.0 | May be 0, if the SDK does not check for quality |
Defines the face of the camera that was used. Use | No |
DocumentDetectorFailure
Superclass that leads to the SDK shutdown. To find out what the reason was, find out which object class has the **isKindOfClass()
** method, equivalent to instanceof
in Java and is
in Dart:
isKindOfClass() | Description | Exemple |
| The token entered is not valid for the corresponding product | Parameterize "test123" as token in the SDK builder |
| You are missing some mandatory permission to run the SDK | Start DocumentDetector without camera permission granted |
| Internet connection failure | User was without internet during facematch in FaceAuthenticator |
| When an SDK request receives a status code of failure | In theory, it shouldn't happen. If it does, let us know! |
| There is no space on the user device's internal storage | When there is no space on the internal storage while capturing the document photo |
Examples
Customizing the Layout
You can customize the layout by creating an object of type DocumentDetectorLayout
and passing it as a parameter in DocumentDetectorBuilder
:
How to get the URL of an audio
Last updated