ID Card Auto-Capture
The SDK finds a Thai National ID card in the live camera feed, captures a sharp, flattened image and sends it to the Thai National ID Card OCR API: 1.25 IC for the front, 0.75 IC for the back.
Call
- Flutter
- Web
- iOS
- Android
- React Native
import 'package:iapp_ekyc_sdk/iapp_ekyc_sdk.dart';
final client = IappEkycClient(apiKey: 'YOUR_API_KEY');
// Front side
final front = await DocumentCaptureView.start(
context,
client: client,
documentType: DocumentType.thaiIdFront,
locale: EkycLocale.th,
);
// Back side (laser code)
final back = await DocumentCaptureView.start(
context,
client: client,
documentType: DocumentType.thaiIdBack,
);
import { IappEkyc } from '@iapp-technology/ekyc-sdk';
const ekyc = new IappEkyc({ apiKey: 'YOUR_API_KEY' });
const front = await ekyc.captureDocument({
mount: document.getElementById('ekyc-mount'),
documentType: 'thaiIdFront',
locale: 'th',
});
const back = await ekyc.captureDocument({
mount: document.getElementById('ekyc-mount'),
documentType: 'thaiIdBack',
});
// iOS (Swift; Objective-C also supported)
let config = IappEkycConfig(apiKey: "YOUR_API_KEY", flow: .documentCapture)
config.documentType = .thaiIdFront
IappEkycSdk.present(from: self, config: config) { result in /* result.document?.rawJSON */ }
// Android (Kotlin; Java also supported)
ekyc.launch(IappEkycRequest.DocumentCapture(config, EkycDocumentType.THAI_ID_FRONT))
// React Native
<IappEkycFlow flow="documentCapture" documentType="thaiIdFront" apiKey="YOUR_API_KEY"
onResult={handleResult} onError={handleError} onCancel={close} />
Install: Getting started for Flutter and Web, iOS, Android & React Native for the native wrappers and camera permission.
Options
documentType:thaiIdFrontfor the front,thaiIdBackfor the back with the laser code (DocumentType.thaiIdFrontin Flutter).locale: the on-screen language,en,thorzh(EkycLocale.thin Flutter).
Result
The result has typed fields plus the raw OCR response in result.raw (result.document?.rawJSON on iOS). Field list: Thai National ID Card OCR API.
How auto-capture works
- Boundary: a four-sided shape in the on-screen guide matching the ID-1 card aspect ratio of 1.586 (85.60 × 53.98 mm), within ±0.25.
- Stability: the card must stay steady across recent frames, its corners drifting less than 2% of the frame diagonal.
- Sharpness: blurry frames are rejected before any credit is spent.
- Perspective correction: the corners are warped to a flat card image of about 300 DPI (1011 × 637 px) before upload.
- Manual fallback: a shutter button appears after 10 seconds if auto-capture has not fired.
The full algorithm specification is in the SDK source.