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
| Parameter | Android (OcrCommunication.ParamKey) | iOS (OcrViewController) | Type | Required | Default |
|---|---|---|---|---|---|
| Identity number | IDENTITY_NUMBER | cnicNumber | String | Yes | — |
| Image width | IMAGE_WIDTH | imageWidth | Int | No | 1000 |
| Font | FONT | — | Resource ID | No | SDK default |
| Primary color | PRIMARY_COLOR | — | String (hex) | No | SDK default |
| Skip processing | — | skipProcessing | Boolean | No | false |
| Blur threshold | BLUR_THRESHOLD | blurThreshold | Float | No | 100 |
Parameter Descriptions
| Parameter | Description |
|---|---|
| Identity number | The 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 width | Target 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. |
| Font | Android only. Resource identifier (R.font.*) for headings and subtitles shown in the OCR interface. Omit to use the SDK default typography. |
| Primary color | Android only. Hex color string (e.g. "#007083") used as the accent color in the OCR interface. Omit to use the SDK default theme. |
| Skip processing | iOS only. When true, the SDK captures card images but skips on-device OCR extraction. Useful for testing the capture flow without running recognition. |
| Blur threshold | iOS 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
)