Scan a single-sided document
By default, BlinkID uses an automatic scanning mode, which detects whether a document requires back-side scanning and prompts the user accordingly.
Set the scanning mode to single when you only need data from one side—for example, when processing documents you know are single-sided, or when only the front-side data is relevant to your use case.
If you're unsure whether a document has a scannable back side, keep the default automatic mode.
It handles both single- and double-sided documents without any configuration.
Set the scanning mode
Pass scanningMode: "single" when initializing the scanning session.
- Web (TS)
- Android (Kotlin)
- iOS (Swift)
import { createBlinkId } from "@microblink/blinkid";
const blinkId = await createBlinkId({
licenseKey: "your-license-key",
scanningMode: "single",
});
blinkId.addOnResultCallback((result) => {
console.log("Result:", result);
void blinkId.destroy();
});
BlinkIdCameraScanningScreen(
blinkIdSdk = blinkIdSdk,
sessionSettings = BlinkIdSessionSettings(
scanningMode = ScanningMode.Single,
),
onScanningSuccess = { result ->
// use result
},
onScanningCanceled = { }
)
let sessionSettings = BlinkIDSessionSettings(
scanningMode: .single
)
let analyzer = try await BlinkIDAnalyzer(
sdk: sdk,
blinkIdSessionSettings: sessionSettings
)
BlinkIDUXView(
analyzer: analyzer,
onScanCompleted: { resultState in
guard let result = resultState.scanningResult else { return }
print("Result:", result)
}
)
Read the result
When scanning completes, the result contains the extracted data aggregated across all enabled modules.
In single mode, subResults always has exactly one entry.
- Web (TS)
- Android (Kotlin)
- iOS (Swift)
blinkId.addOnResultCallback((result) => {
// Aggregated result fields
console.log("First name:", result.firstName?.latin?.value);
console.log("Last name:", result.lastName?.latin?.value);
console.log("Date of birth:", result.dateOfBirth?.originalString?.latin?.value);
console.log("Document number:", result.documentNumber?.latin?.value);
console.log("Date of expiry:", result.dateOfExpiry?.originalString?.latin?.value);
// Per-side sub-result (single mode: always one entry)
const front = result.subResults[0];
console.log("MRZ:", front.mrz);
console.log("VIZ:", front.viz);
void blinkId.destroy();
});
onScanningSuccess = { result ->
// Aggregated result fields
println("First name: ${result.firstName?.value}")
println("Last name: ${result.lastName?.value}")
println("Date of birth: ${result.dateOfBirth?.value}")
println("Document number: ${result.documentNumber?.value}")
println("Date of expiry: ${result.dateOfExpiry?.value}")
// Per-side sub-result (single mode: always one entry)
val front = result.subResults[0]
println("MRZ: ${front.mrz}")
println("VIZ: ${front.viz}")
}
BlinkIDUXView(
analyzer: analyzer,
onScanCompleted: { resultState in
guard let result = resultState.scanningResult else { return }
// Aggregated result fields
print("First name:", result.firstName?.value ?? "")
print("Last name:", result.lastName?.value ?? "")
print("Date of birth:", result.dateOfBirth?.value ?? "")
print("Document number:", result.documentNumber?.value ?? "")
print("Date of expiry:", result.dateOfExpiry?.value ?? "")
// Per-side sub-result (single mode: always one entry)
let front = result.subResults[0]
print("MRZ:", front.mrz as Any)
print("VIZ:", front.viz as Any)
}
)
For the full list of fields available on the result, see the API references for Web, Android, and iOS.