Document Scanner for Compose Multiplatform (Android/iOS) using VNDocumentCameraViewController on iOS and MLKit Document scanner on Android.
Supported Compose versions:
| EasyDocumentScan Version | Compose version |
|---|---|
| 0.1.0+ | 1.7 |
| 0.2.0+ | 1.8 |
| 0.3.0+ | 1.9 |
| 0.4.0+ | 1.10 |
Note
Starting with 0.3.2, artifact id changed from "documentscanner" to "documentscanner-compose" and a new "documentscanner-core" artifact was introduced that contains the KmpFile abstraction as well as some Helper functions.
Add the dependency to your commonMain sourceSet (KMP) / Android dependencies (android only):
implementation("io.github.kalinjul.easydocumentscan:documentscanner-compose:0.4.0")Or, for your libs.versions.toml:
[versions]
easydocumentscanner = "0.4.0"
[libraries]
easydocumentscanner-compose = { module = "io.github.kalinjul.easydocumentscan:documentscanner-compose", version.ref = "easydocumentscanner" }
easydocumentscanner-core = { module = "io.github.kalinjul.easydocumentscan:documentscanner-core", version.ref = "easydocumentscanner" }val scanner = rememberDocumentScanner(
onResult = {
// handle result images
},
options = DocumentScannerOptions(
DocumentScannerOptionsAndroid(
pageLimit = 3,
allowGalleryImport = true,
scannerMode = DocumentScannerModeAndroid.BASE
),
DocumentScannerOptionsIos(
captureMode = DocumentCaptureMode.MANUAL
)
)
)
Button(onClick = { scanner.scan() }) {
Text("Scan")
}Check out the included sample app.