ebs.ocr
(FintechOS Studio 20.2.1 and later)
Extracts text fields from an identity document scan stored in the file upload location.
IMPORTANT!
This function requires the Computer Vision automation processor to be installed on your environment.
This function requires the Computer Vision automation processor to be installed on your environment.
Syntax
Copy
function ebs.ocr(realFileName: string, callback: any, errorCallback: any): void;
| Parameter | Type | Description |
|---|---|---|
realFileName
|
string | Name of the identity document file that will be processed, including the file extension. |
callback
|
function | Callback function to run on the returned fields. |
errorCallback (optional) |
function | Callback function to run in case of failure. |
Return Value
Returns the extracted text fields in a JSON object that can be used as input for the callback function. This may vary depending on the OCR service provider and type of document.
For example:
Copy
{ Message: null, IsSuccess: true, ClientScript: null, ErrorCode: 0, LastName: "Doe", GivenName: "Johnathan", DocumentNumber: "123456789", BirthDate: "1960-01-01", ExpiryDate … }
Examples
In this example:
- We process the ID_b4c6c641-dd45-4654-9671-55cdd28e67c0.jpg file containing the user's ID scan.
- We populate the firstName attribute of the current record with the result returned by the OCR processor in the GivenName field.
- We populate the lastName attribute of the current record with the result returned by the OCR processor in the LastName field.
For details on how to access the attributes of a current record, see formData.model.
Copy
function populateNames(callbackContent){
formData.model.firstName = callbackContent.GivenName
formData.model.lastName = callbackContent.LastName
};
ebs.ocr('ID_b4c6c641-dd45-4654-9671-55cdd28e67c0.jpg', populateNames);