Skip to main content

Initialization Parameters

Parameters passed when launching the OCR Lite SDK. The identity number is required on both platforms; all other parameters are optional and have sensible defaults.

Parameters

ParameterAndroid (OcrCommunication.ParamKey)iOS (OcrViewController)TypeRequiredDefault
Identity numberIDENTITY_NUMBERcnicNumberStringYes
Image widthIMAGE_WIDTHimageWidthIntNo1000
FontFONTResource IDNoSDK default
Primary colorPRIMARY_COLORString (hex)NoSDK default
Skip processingskipProcessingBooleanNofalse
Blur thresholdBLUR_THRESHOLDblurThresholdFloatNo100

Parameter Descriptions

ParameterDescription
Identity numberThe CNIC number already known to your app. The SDK extracts the number from the scanned card and compares it against this value. An empty or invalid value causes a LAUNCH_FAILURE event.
Image widthTarget width in pixels for captured card images. Both front and back images are saved at this width. Higher values preserve more detail but use more storage; lower values reduce file size.
FontAndroid only. Resource identifier (R.font.*) for headings and subtitles shown in the OCR interface. Omit to use the SDK default typography.
Primary colorAndroid only. Hex color string (e.g. "#007083") used as the accent color in the OCR interface. Omit to use the SDK default theme.
Skip processingiOS only. When true, the SDK captures card images but skips on-device OCR extraction. Useful for testing the capture flow without running recognition.
Blur thresholdiOS only. Sensitivity for detecting blurred or shaky camera frames during capture. Lower values are stricter; higher values are more lenient. Valid range: 50–400.

Android

Pass parameters as Intent extras when launching com.fetchsky.ocrlitesdk.OcrActivity:

val intent = Intent(this, com.fetchsky.ocrlitesdk.OcrActivity::class.java)
intent.putExtra(OcrCommunication.ParamKey.IDENTITY_NUMBER.value, cnicNumber)
intent.putExtra(OcrCommunication.ParamKey.IMAGE_WIDTH.value, 1000)
intent.putExtra(OcrCommunication.ParamKey.FONT.value, R.font.poppins) // Optional
intent.putExtra(OcrCommunication.ParamKey.PRIMARY_COLOR.value, "#007083") // Optional
startActivity(intent)

iOS

Pass parameters to the OcrViewController initializer:

let ocrController = OcrViewController(
cnicNumber: "your_cnic_number",
skipProcessing: false,
blurThreshold: 100,
imageWidth: 1000
)