@capgo/capacitor-document-scanner 8.4.14 → 8.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapgoCapacitorDocumentScanner.podspec +8 -0
- package/Package.swift +11 -2
- package/README.md +52 -12
- package/dist/docs.json +3 -3
- package/dist/esm/definitions.d.ts +14 -7
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/DocumentScannerPlugin/DocScanner.swift +14 -635
- package/ios/Sources/DocumentScannerPlugin/DocumentScannerPlugin.swift +1 -1
- package/ios/Sources/DocumentScannerPlugin/VisionKitScanSwizzle.swift +675 -0
- package/ios/Tests/DocumentScannerPluginTests/DocumentScannerPluginTests.swift +6 -1
- package/package.json +5 -3
- package/scripts/configure-visionkit-swizzle.mjs +66 -0
- package/ios/Sources/DocumentScannerPlugin/VisionKitPrivateConstants.swift +0 -10
|
@@ -14,4 +14,12 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
|
+
# capgo-visionkit-swizzle: scripts/configure-visionkit-swizzle.mjs sets this during cap sync.
|
|
18
|
+
# false keeps the private VisionKit swizzle out of the App Store binary.
|
|
19
|
+
vision_kit_swizzle_enabled = false
|
|
20
|
+
if vision_kit_swizzle_enabled
|
|
21
|
+
s.pod_target_xcconfig = {
|
|
22
|
+
'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => '$(inherited) CAPGO_DOCUMENT_SCANNER_VISIONKIT_SWIZZLE'
|
|
23
|
+
}
|
|
24
|
+
end
|
|
17
25
|
end
|
package/Package.swift
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// swift-tools-version: 5.9
|
|
2
2
|
import PackageDescription
|
|
3
3
|
|
|
4
|
+
// capgo-visionkit-swizzle: scripts/configure-visionkit-swizzle.mjs sets this during cap sync.
|
|
5
|
+
// false keeps the private VisionKit swizzle out of the App Store binary.
|
|
6
|
+
let visionKitSwizzleEnabled = false
|
|
7
|
+
let visionKitSwizzleSwiftSettings: [SwiftSetting] = visionKitSwizzleEnabled
|
|
8
|
+
? [.define("CAPGO_DOCUMENT_SCANNER_VISIONKIT_SWIZZLE")]
|
|
9
|
+
: []
|
|
10
|
+
|
|
4
11
|
let package = Package(
|
|
5
12
|
name: "CapgoCapacitorDocumentScanner",
|
|
6
13
|
platforms: [.iOS(.v15)],
|
|
@@ -19,10 +26,12 @@ let package = Package(
|
|
|
19
26
|
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
27
|
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
28
|
],
|
|
22
|
-
path: "ios/Sources/DocumentScannerPlugin"
|
|
29
|
+
path: "ios/Sources/DocumentScannerPlugin",
|
|
30
|
+
swiftSettings: visionKitSwizzleSwiftSettings),
|
|
23
31
|
.testTarget(
|
|
24
32
|
name: "DocumentScannerPluginTests",
|
|
25
33
|
dependencies: ["DocumentScannerPlugin"],
|
|
26
|
-
path: "ios/Tests/DocumentScannerPluginTests"
|
|
34
|
+
path: "ios/Tests/DocumentScannerPluginTests",
|
|
35
|
+
swiftSettings: visionKitSwizzleSwiftSettings)
|
|
27
36
|
]
|
|
28
37
|
)
|
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ Scan paper documents with the native scanner UI: VisionKit on iOS and Google ML
|
|
|
19
19
|
## Key features
|
|
20
20
|
|
|
21
21
|
- **Native scanner UI**: `scanDocument()` opens the VisionKit document camera on iOS and the ML Kit document scanner on Android, with automatic edge detection and perspective correction.
|
|
22
|
-
- **Multi-page scans**: capture up to 24 pages in one session, or pass `maxNumDocuments: 1` for single-page mode.
|
|
23
|
-
- **Crop and review**:
|
|
22
|
+
- **Multi-page scans**: capture up to 24 pages in one session, or pass `maxNumDocuments: 1` for single-page mode. Android stops after that page. On iOS the camera stops only when `iosVisionKitSwizzle` is enabled; the default binary drops the extra pages after Save.
|
|
23
|
+
- **Crop and review**: Android always offers crop and rotate. On iOS, VisionKit shows its review screen before Save. Forcing the editor after every capture is an opt-in swizzle. See [iOS App Store review](#ios-app-store-review-and-the-visionkit-swizzle).
|
|
24
24
|
- **Image cleanup**: tune `brightness` and `contrast` on both platforms. On Android, `scannerMode` adds filters and ML cleaning that removes stains and fingers.
|
|
25
25
|
- **Flexible output**: get file paths or base64 strings with `responseType`, plus a `success` or `cancel` status.
|
|
26
26
|
- **Platforms**: iOS and Android. Web is not supported: `scanDocument()` rejects as unimplemented.
|
|
@@ -77,6 +77,46 @@ This limitation is due to:
|
|
|
77
77
|
|
|
78
78
|
**For development and testing, always use a real Android device.**
|
|
79
79
|
|
|
80
|
+
### iOS App Store review and the VisionKit swizzle
|
|
81
|
+
|
|
82
|
+
The default iOS binary does not include the private VisionKit swizzle. Those calls load `VNDocumentCameraViewController_InProcess` with `NSClassFromString` and exchange `documentCameraController:canAddImages:` through `method_exchangeImplementations`. The same code reads private UIKit gesture state so it can open the crop editor. The iPhoneOS 27.1 SDK still has no public page-limit or per-capture callback on `VNDocumentCameraViewController`.
|
|
83
|
+
|
|
84
|
+
This follows `@capgo/capacitor-social-login`: the swizzle stays out of the build unless the app opts in.
|
|
85
|
+
|
|
86
|
+
With the default build:
|
|
87
|
+
|
|
88
|
+
- Scanning uses the public `VNDocumentCameraViewController` API.
|
|
89
|
+
- `maxNumDocuments` trims the pages returned after Save. The camera can still capture up to VisionKit's 24-page system limit.
|
|
90
|
+
- `letUserAdjustCrop` and `reviewCapturedDocument` do not force the editor after each capture. VisionKit's own review screen before Save is unchanged.
|
|
91
|
+
- Android behavior is unchanged.
|
|
92
|
+
|
|
93
|
+
Enable the swizzle when you need that iOS behavior back:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import type { CapacitorConfig } from '@capacitor/cli';
|
|
97
|
+
|
|
98
|
+
const config: CapacitorConfig = {
|
|
99
|
+
plugins: {
|
|
100
|
+
DocumentScanner: {
|
|
101
|
+
iosVisionKitSwizzle: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default config;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Then run `bunx cap sync`. That command writes the flag into `Package.swift` and `CapgoCapacitorDocumentScanner.podspec` in the installed plugin, and the next iOS build compiles `CAPGO_DOCUMENT_SCANNER_VISIONKIT_SWIZZLE`. Remove the flag and run `bunx cap sync` again to ship the default binary.
|
|
110
|
+
|
|
111
|
+
With the swizzle compiled in:
|
|
112
|
+
|
|
113
|
+
- `maxNumDocuments` stops the camera when the limit is reached. VisionKit's own cap is still 24.
|
|
114
|
+
- `letUserAdjustCrop` opens the VisionKit editor after each capture.
|
|
115
|
+
- `reviewCapturedDocument` shows the current page before the next capture, and the editor still opens when the limit is reached.
|
|
116
|
+
- The binary contains `method_exchangeImplementations`, the private class lookup, and the private gesture reads. Android is unchanged.
|
|
117
|
+
|
|
118
|
+
That can make App Store review harder. Static analysis may name `method_exchangeImplementations`. You can still explain the use in the review notes: the swizzle only caps the page count and opens the editor inside Apple's document scanner. It does not read private user data, and it does not change anything outside that screen. Some submissions get a question and are approved after that explanation. Others go through with no mention of the symbol. Approval is per submission, so a previous pass does not decide the next binary.
|
|
119
|
+
|
|
80
120
|
## Demo
|
|
81
121
|
|
|
82
122
|
### Scanning one note
|
|
@@ -133,16 +173,16 @@ Opens the device camera and starts the document scanning experience.
|
|
|
133
173
|
|
|
134
174
|
#### ScanDocumentOptions
|
|
135
175
|
|
|
136
|
-
| Prop | Type | Description
|
|
137
|
-
| ---------------------------- | ----------------------------------------------------- |
|
|
138
|
-
| **`croppedImageQuality`** | <code>number</code> | Android only: quality of the cropped image from 0 - 100 (100 is best).
|
|
139
|
-
| **`letUserAdjustCrop`** | <code>boolean</code> | Allow the user to adjust the detected crop before saving. On iOS
|
|
140
|
-
| **`reviewCapturedDocument`** | <code>boolean</code> | When enabled, shows the current scanned page before continuing so the user can review it and explicitly continue or finish the flow. On iOS this forces the native VisionKit preview/editor between captures. On Android this switches to a one-page-at-a-time flow between ML Kit sessions.
|
|
141
|
-
| **`maxNumDocuments`** | <code>number</code> | Maximum number of documents to scan. On iOS
|
|
142
|
-
| **`responseType`** | <code><a href="#responsetype">ResponseType</a></code> | Format to return scanned images in (file paths or base64 strings).
|
|
143
|
-
| **`brightness`** | <code>number</code> | Brightness adjustment applied to scanned images. Range: -255 to 255 (0 = no change, positive = brighter, negative = darker) Useful for compensating low-light scans.
|
|
144
|
-
| **`contrast`** | <code>number</code> | Contrast adjustment applied to scanned images. Range: 0.0 to 10.0 (1.0 = no change, >1 = more contrast, <1 = less contrast) Helps improve text clarity in poorly lit scans.
|
|
145
|
-
| **`scannerMode`** | <code><a href="#scannermode">ScannerMode</a></code> | Android only: scanner mode that controls ML Kit features and filters. Independent of `letUserAdjustCrop` (crop/rotate is available in all modes). - 'base': Basic scan with crop/rotate, no filters or ML cleaning - 'base_with_filter': Adds grayscale and auto-enhancement filters - 'full': All features including ML-based image cleaning (erases stains, fingers, etc.)
|
|
176
|
+
| Prop | Type | Description | Default |
|
|
177
|
+
| ---------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------- |
|
|
178
|
+
| **`croppedImageQuality`** | <code>number</code> | Android only: quality of the cropped image from 0 - 100 (100 is best). | <code>100</code> |
|
|
179
|
+
| **`letUserAdjustCrop`** | <code>boolean</code> | Allow the user to adjust the detected crop before saving. On iOS, VisionKit already shows its own review screen before Save. Forcing that editor after every capture needs the private VisionKit swizzle, which is not compiled into the default binary. Set `plugins.DocumentScanner.iosVisionKitSwizzle` to true and run `bunx cap sync` to include it. See the README. On Android, crop/rotate is always part of the ML Kit UI in every <a href="#scannermode">ScannerMode</a>; use `scannerMode` to control filters and ML cleaning instead. | <code>true</code> |
|
|
180
|
+
| **`reviewCapturedDocument`** | <code>boolean</code> | When enabled, shows the current scanned page before continuing so the user can review it and explicitly continue or finish the flow. On iOS this forces the native VisionKit preview/editor between captures only when `plugins.DocumentScanner.iosVisionKitSwizzle` is compiled in. The default binary leaves the system review screen before Save unchanged. On Android this switches to a one-page-at-a-time flow between ML Kit sessions. With the iOS swizzle enabled, the review/editor screen is still shown when the scan limit is reached. | <code>false</code> |
|
|
181
|
+
| **`maxNumDocuments`** | <code>number</code> | Maximum number of documents to scan. On iOS the default binary uses public VisionKit and trims the returned pages to this limit after Save. VisionKit itself still allows up to 24 captures. Stopping the camera at a lower limit requires `plugins.DocumentScanner.iosVisionKitSwizzle`. On Android: customizable limit; defaults to 20 for performance (clamped 1-24). Set to 1 for single-scan mode. Android stops after one document. On iOS the camera stops after one document only when `plugins.DocumentScanner.iosVisionKitSwizzle` is compiled in. | <code>20 on Android, 24 on iOS</code> |
|
|
182
|
+
| **`responseType`** | <code><a href="#responsetype">ResponseType</a></code> | Format to return scanned images in (file paths or base64 strings). | <code>ResponseType.ImageFilePath</code> |
|
|
183
|
+
| **`brightness`** | <code>number</code> | Brightness adjustment applied to scanned images. Range: -255 to 255 (0 = no change, positive = brighter, negative = darker) Useful for compensating low-light scans. | <code>0</code> |
|
|
184
|
+
| **`contrast`** | <code>number</code> | Contrast adjustment applied to scanned images. Range: 0.0 to 10.0 (1.0 = no change, >1 = more contrast, <1 = less contrast) Helps improve text clarity in poorly lit scans. | <code>1.0</code> |
|
|
185
|
+
| **`scannerMode`** | <code><a href="#scannermode">ScannerMode</a></code> | Android only: scanner mode that controls ML Kit features and filters. Independent of `letUserAdjustCrop` (crop/rotate is available in all modes). - 'base': Basic scan with crop/rotate, no filters or ML cleaning - 'base_with_filter': Adds grayscale and auto-enhancement filters - 'full': All features including ML-based image cleaning (erases stains, fingers, etc.) | <code>ScannerMode.Full</code> |
|
|
146
186
|
|
|
147
187
|
|
|
148
188
|
### Type Aliases
|
package/dist/docs.json
CHANGED
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"name": "default"
|
|
101
101
|
}
|
|
102
102
|
],
|
|
103
|
-
"docs": "Allow the user to adjust the detected crop before saving.\nOn iOS
|
|
103
|
+
"docs": "Allow the user to adjust the detected crop before saving.\nOn iOS, VisionKit already shows its own review screen before Save.\nForcing that editor after every capture needs the private VisionKit swizzle, which\nis not compiled into the default binary. Set `plugins.DocumentScanner.iosVisionKitSwizzle`\nto true and run `bunx cap sync` to include it. See the README.\nOn Android, crop/rotate is always part of the ML Kit UI in every ScannerMode;\nuse `scannerMode` to control filters and ML cleaning instead.",
|
|
104
104
|
"complexTypes": [],
|
|
105
105
|
"type": "boolean | undefined"
|
|
106
106
|
},
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"name": "default"
|
|
113
113
|
}
|
|
114
114
|
],
|
|
115
|
-
"docs": "When enabled, shows the current scanned page before continuing so the user can\nreview it and explicitly continue or finish the flow.\nOn iOS this forces the native VisionKit preview/editor between captures.\nOn Android this switches to a one-page-at-a-time flow between ML Kit sessions.\
|
|
115
|
+
"docs": "When enabled, shows the current scanned page before continuing so the user can\nreview it and explicitly continue or finish the flow.\nOn iOS this forces the native VisionKit preview/editor between captures only when\n`plugins.DocumentScanner.iosVisionKitSwizzle` is compiled in. The default binary\nleaves the system review screen before Save unchanged.\nOn Android this switches to a one-page-at-a-time flow between ML Kit sessions.\nWith the iOS swizzle enabled, the review/editor screen is still shown when the scan limit is reached.",
|
|
116
116
|
"complexTypes": [],
|
|
117
117
|
"type": "boolean | undefined"
|
|
118
118
|
},
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"name": "default"
|
|
125
125
|
}
|
|
126
126
|
],
|
|
127
|
-
"docs": "Maximum number of documents to scan.\nOn iOS
|
|
127
|
+
"docs": "Maximum number of documents to scan.\nOn iOS the default binary uses public VisionKit and trims the returned pages to this\nlimit after Save. VisionKit itself still allows up to 24 captures. Stopping the camera\nat a lower limit requires `plugins.DocumentScanner.iosVisionKitSwizzle`.\nOn Android: customizable limit; defaults to 20 for performance (clamped 1-24).\nSet to 1 for single-scan mode. Android stops after one document. On iOS the camera\nstops after one document only when `plugins.DocumentScanner.iosVisionKitSwizzle`\nis compiled in.",
|
|
128
128
|
"complexTypes": [],
|
|
129
129
|
"type": "number | undefined"
|
|
130
130
|
},
|
|
@@ -12,8 +12,10 @@ export interface ScanDocumentOptions {
|
|
|
12
12
|
croppedImageQuality?: number;
|
|
13
13
|
/**
|
|
14
14
|
* Allow the user to adjust the detected crop before saving.
|
|
15
|
-
* On iOS
|
|
16
|
-
*
|
|
15
|
+
* On iOS, VisionKit already shows its own review screen before Save.
|
|
16
|
+
* Forcing that editor after every capture needs the private VisionKit swizzle, which
|
|
17
|
+
* is not compiled into the default binary. Set `plugins.DocumentScanner.iosVisionKitSwizzle`
|
|
18
|
+
* to true and run `bunx cap sync` to include it. See the README.
|
|
17
19
|
* On Android, crop/rotate is always part of the ML Kit UI in every ScannerMode;
|
|
18
20
|
* use `scannerMode` to control filters and ML cleaning instead.
|
|
19
21
|
* @default true
|
|
@@ -22,18 +24,23 @@ export interface ScanDocumentOptions {
|
|
|
22
24
|
/**
|
|
23
25
|
* When enabled, shows the current scanned page before continuing so the user can
|
|
24
26
|
* review it and explicitly continue or finish the flow.
|
|
25
|
-
* On iOS this forces the native VisionKit preview/editor between captures
|
|
27
|
+
* On iOS this forces the native VisionKit preview/editor between captures only when
|
|
28
|
+
* `plugins.DocumentScanner.iosVisionKitSwizzle` is compiled in. The default binary
|
|
29
|
+
* leaves the system review screen before Save unchanged.
|
|
26
30
|
* On Android this switches to a one-page-at-a-time flow between ML Kit sessions.
|
|
27
|
-
*
|
|
31
|
+
* With the iOS swizzle enabled, the review/editor screen is still shown when the scan limit is reached.
|
|
28
32
|
* @default false
|
|
29
33
|
*/
|
|
30
34
|
reviewCapturedDocument?: boolean;
|
|
31
35
|
/**
|
|
32
36
|
* Maximum number of documents to scan.
|
|
33
|
-
* On iOS
|
|
34
|
-
*
|
|
37
|
+
* On iOS the default binary uses public VisionKit and trims the returned pages to this
|
|
38
|
+
* limit after Save. VisionKit itself still allows up to 24 captures. Stopping the camera
|
|
39
|
+
* at a lower limit requires `plugins.DocumentScanner.iosVisionKitSwizzle`.
|
|
35
40
|
* On Android: customizable limit; defaults to 20 for performance (clamped 1-24).
|
|
36
|
-
* Set to 1 for single-scan mode
|
|
41
|
+
* Set to 1 for single-scan mode. Android stops after one document. On iOS the camera
|
|
42
|
+
* stops after one document only when `plugins.DocumentScanner.iosVisionKitSwizzle`
|
|
43
|
+
* is compiled in.
|
|
37
44
|
* @default 20 on Android, 24 on iOS
|
|
38
45
|
*/
|
|
39
46
|
maxNumDocuments?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAoFA,MAAM,CAAN,IAAY,WAiBX;AAjBD,WAAY,WAAW;IACrB;;;OAGG;IACH,4BAAa,CAAA;IAEb;;OAEG;IACH,kDAAmC,CAAA;IAEnC;;;OAGG;IACH,4BAAa,CAAA;AACf,CAAC,EAjBW,WAAW,KAAX,WAAW,QAiBtB;AAED,MAAM,CAAN,IAAY,YAUX;AAVD,WAAY,YAAY;IACtB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,+CAA+B,CAAA;AACjC,CAAC,EAVW,YAAY,KAAZ,YAAY,QAUvB;AAsBD,MAAM,CAAN,IAAY,0BAUX;AAVD,WAAY,0BAA0B;IACpC;;OAEG;IACH,iDAAmB,CAAA;IAEnB;;OAEG;IACH,+CAAiB,CAAA;AACnB,CAAC,EAVW,0BAA0B,KAA1B,0BAA0B,QAUrC","sourcesContent":["export interface DocumentScannerPlugin {\n /**\n * Opens the device camera and starts the document scanning experience.\n */\n scanDocument(options?: ScanDocumentOptions): Promise<ScanDocumentResponse>;\n}\n\nexport interface ScanDocumentOptions {\n /**\n * Android only: quality of the cropped image from 0 - 100 (100 is best).\n * @default 100\n */\n croppedImageQuality?: number;\n\n /**\n * Allow the user to adjust the detected crop before saving.\n * On iOS, VisionKit already shows its own review screen before Save.\n * Forcing that editor after every capture needs the private VisionKit swizzle, which\n * is not compiled into the default binary. Set `plugins.DocumentScanner.iosVisionKitSwizzle`\n * to true and run `bunx cap sync` to include it. See the README.\n * On Android, crop/rotate is always part of the ML Kit UI in every ScannerMode;\n * use `scannerMode` to control filters and ML cleaning instead.\n * @default true\n */\n letUserAdjustCrop?: boolean;\n\n /**\n * When enabled, shows the current scanned page before continuing so the user can\n * review it and explicitly continue or finish the flow.\n * On iOS this forces the native VisionKit preview/editor between captures only when\n * `plugins.DocumentScanner.iosVisionKitSwizzle` is compiled in. The default binary\n * leaves the system review screen before Save unchanged.\n * On Android this switches to a one-page-at-a-time flow between ML Kit sessions.\n * With the iOS swizzle enabled, the review/editor screen is still shown when the scan limit is reached.\n * @default false\n */\n reviewCapturedDocument?: boolean;\n\n /**\n * Maximum number of documents to scan.\n * On iOS the default binary uses public VisionKit and trims the returned pages to this\n * limit after Save. VisionKit itself still allows up to 24 captures. Stopping the camera\n * at a lower limit requires `plugins.DocumentScanner.iosVisionKitSwizzle`.\n * On Android: customizable limit; defaults to 20 for performance (clamped 1-24).\n * Set to 1 for single-scan mode. Android stops after one document. On iOS the camera\n * stops after one document only when `plugins.DocumentScanner.iosVisionKitSwizzle`\n * is compiled in.\n * @default 20 on Android, 24 on iOS\n */\n maxNumDocuments?: number;\n\n /**\n * Format to return scanned images in (file paths or base64 strings).\n * @default ResponseType.ImageFilePath\n */\n responseType?: ResponseType;\n\n /**\n * Brightness adjustment applied to scanned images.\n * Range: -255 to 255 (0 = no change, positive = brighter, negative = darker)\n * Useful for compensating low-light scans.\n * @default 0\n */\n brightness?: number;\n\n /**\n * Contrast adjustment applied to scanned images.\n * Range: 0.0 to 10.0 (1.0 = no change, >1 = more contrast, <1 = less contrast)\n * Helps improve text clarity in poorly lit scans.\n * @default 1.0\n */\n contrast?: number;\n\n /**\n * Android only: scanner mode that controls ML Kit features and filters.\n * Independent of `letUserAdjustCrop` (crop/rotate is available in all modes).\n * - 'base': Basic scan with crop/rotate, no filters or ML cleaning\n * - 'base_with_filter': Adds grayscale and auto-enhancement filters\n * - 'full': All features including ML-based image cleaning (erases stains, fingers, etc.)\n * @default ScannerMode.Full\n */\n scannerMode?: ScannerMode;\n}\n\nexport enum ScannerMode {\n /**\n * Basic document scanning with crop and rotate features only.\n * No filters or ML-based enhancements.\n */\n Base = 'base',\n\n /**\n * Basic features plus automatic filters (grayscale, auto-enhancement).\n */\n BaseWithFilter = 'base_with_filter',\n\n /**\n * Full feature set including ML-based image cleaning.\n * Automatically removes stains, fingers, and other artifacts.\n */\n Full = 'full',\n}\n\nexport enum ResponseType {\n /**\n * Return scanned images as base64-encoded strings.\n */\n Base64 = 'base64',\n\n /**\n * Return scanned images as file paths on disk.\n */\n ImageFilePath = 'imageFilePath',\n}\n\nexport interface ScanDocumentResponse {\n /**\n * Scanned images in the requested response format.\n */\n scannedImages?: string[];\n\n /**\n * Indicates whether the scan completed or was cancelled.\n */\n status?: ScanDocumentResponseStatus;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n\nexport enum ScanDocumentResponseStatus {\n /**\n * The scan completed successfully.\n */\n Success = 'success',\n\n /**\n * The user cancelled the scan flow.\n */\n Cancel = 'cancel',\n}\n"]}
|