capacitor-docscanner
v0.0.1
Published
DocScanner for capacitor
Downloads
64
Maintainers
Readme
capacitor-docscanner
The capacitor-docscanner
allows you to scan documents using the camera on your device. The plugin automatically crops the scanned documents and provides them as Base64-encoded JPEG images.
This plugin leverages Google's ML Kit on Android and Vision API on iOS to perform document scanning and cropping.
Versioning
See the table below for details.
| Version | Description | Capacitor Version | |---------|--------------------------------|-------------------| | 0.0.1 | Initial release. | 6 |
Install
npm install capacitor-docscanner
npx cap sync
iOS configuration
iOS requires the following usage description be added and filled out for your app in Info.plist:
NSCameraUsageDescription
API
scan(...)
scan(opts?: DocScanOpts | undefined) => Promise<DocScanResult>
Initiates the document scanning process. This method opens the document scanner and allows the user to scan documents.
| Param | Type | Description |
| ---------- | --------------------------------------------------- | -------------------------------------------------------- |
| opts
| DocScanOpts | Optional configuration options for the scanning process. |
Returns: Promise<DocScanResult>
Interfaces
DocScanResult
The result of a document scanning operation.
| Prop | Type | Description |
| ------------ | --------------------- | ----------------------------------------------------------------------------- |
| images
| string[] | An array of scanned images, each represented as a Base64-encoded JPEG string. |
DocScanOpts
Configuration options for the document scanning process.
| Prop | Type | Description |
| -------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| maxScans
| number | The maximum number of documents that can be scanned. If not provided, the scanner will scan only one Note: This option is only supported on Android, in ios is ignored. |