Setup Accura OCR
To initialize sdk on app start:
Setting up License
getAccuraSetup = () => {
//Method for get license info from native OS.
AccurascanKyc.getMetaData((error, response) => {
if (error != null) {
} else {
console.log(response);
}
});
};
Success: JSON String Response = { countries: Array[], isValid: boolean, isOCREnable: boolean }
Setting up Configuration's,Error mssages and Scaning title messages
setUpCustomMessages = () => {
var config = {
setFaceBlurPercentage: 80, // 0 for clean face and 100 for Blurry face
setHologramDetection: true, // true to check hologram on face
setLowLightTolerance: 10, // 0 for full dark document and 100 for full bright document
setMotionThreshold: 25, // 1 - allows 1% motion on document and 100 - it can not detect motion and allow document to scan.
setMinGlarePercentage: 6, // Set min percentage for glare
setMaxGlarePercentage: 99, // Set max percentage for glare
setBlurPercentage: 60, //0 for clean document and 100 for Blurry document
setIsDocEnable : true, //set false to disable Document Liveness
setDocUrl : "URL", //Add you Document Liveness URL
setProgressMessage: "API Loading...", //Add Loading Text
setHideProgressDialogue: false, //true to disable Progress Dialogue
setApiTimer: 50, // Set the API calling timer
};
var accuraConfigs = {
enableLogs: 0,
isShowLogo: 1, //To hide Logo pass 0
isFlipImg: 1, //To hide flip animation pass 0
CameraScreen_Frame_Color: '#D5323F', //Pass a Hex Code to change frame color
CameraScreen_Text_Color: '#FFFFFF', //Pass a Hex Code to change text color
CameraScreen_Text_Border_Color: '#000000', //Pass a Hex Code to change text border color
CameraScreen_Color: '#80000000', //Pass a Hex Code to change Camera Screen Background color
CameraScreen_Back_Button: 1, //Pass 0 to hide back button in iOS
CameraScreen_Change_Button: 1, //Pass 0 to hide flip camera button
CameraScreen_CornerBorder_Enable: false, //To enable corner border frame pass true
Disable_Card_Name: false, //To disable taking card name automatically pass true
CameraScreen_Border_Width: 10,
Disable_Card_Name: false,
ACCURA_ERROR_CODE_MOTION: 'Keep Document Steady',
ACCURA_ERROR_CODE_DOCUMENT_IN_FRAME: 'Keep document in frame',
ACCURA_ERROR_CODE_BRING_DOCUMENT_IN_FRAME: 'Bring card near to frame',
ACCURA_ERROR_CODE_PROCESSING: 'Processing...',
ACCURA_ERROR_CODE_BLUR_DOCUMENT: 'Blur detect in document',
ACCURA_ERROR_CODE_FACE_BLUR: 'Blur detected over face',
ACCURA_ERROR_CODE_GLARE_DOCUMENT: 'Glare detect in document',
ACCURA_ERROR_CODE_HOLOGRAM: 'Hologram Detected',
ACCURA_ERROR_CODE_DARK_DOCUMENT: 'Low lighting detected',
ACCURA_ERROR_CODE_PHOTO_COPY_DOCUMENT:
'Can not accept Photo Copy Document',
ACCURA_ERROR_CODE_FACE: 'Face not detected',
ACCURA_ERROR_CODE_MRZ: 'MRZ not detected',
ACCURA_ERROR_CODE_PASSPORT_MRZ: 'Passport MRZ not detected',
ACCURA_ERROR_CODE_ID_MRZ: 'ID MRZ not detected',
ACCURA_ERROR_CODE_VISA_MRZ: 'Visa MRZ not detected',
ACCURA_ERROR_CODE_UPSIDE_DOWN_SIDE:
'Document is upside down. Place it properly',
ACCURA_ERROR_CODE_WRONG_SIDE: 'Scanning wrong side of Document',
};
var accuraTitleMsg = {
SCAN_TITLE_OCR_FRONT: 'Scan Front side of ',
SCAN_TITLE_OCR_BACK: 'Scan Back side of ',
SCAN_TITLE_OCR: 'Scan ',
SCAN_TITLE_MRZ_PDF417_FRONT: 'Scan Front Side of Document',
SCAN_TITLE_MRZ_PDF417_BACK: 'Scan Back Side of Document',
SCAN_TITLE_DLPLATE: 'Scan Number plate',
SCAN_TITLE_BARCODE: 'Scan Barcode',
SCAN_TITLE_BANKCARD: 'Scan BankCard',
};
//Method for setup config into native OS.
AccurascanKyc.setupAccuraConfig(
[config, accuraConfigs, accuraTitleMsg],
(error, response) => {
if (error != null) {
console.log(error);
} else {
console.log('Message:- ', response);
}
}
);
}
Method for scan OCR documents.
onPressOCR = () => {
let passArgs = [
// all the values will be provided by the license
this.countrySelected.id, //integer
this.cardSelected.id, //integer
this.cardSelected.name, //String
this.cardSelected.type, //integer
];
//Method for start OCR scaning from native OS.
AccurascanKyc.startOcrWithCard(passArgs, (error, response) => {
if (error != null) {
console.log(error);
} else {
console.log('Success!', response);
}
});
};
Success: JSON Response Error: String
Last updated