react-native-docs-scanner
v1.0.0
Published
React Native Documents Scanner
Maintainers
Readme
react-native-docs-scanner
Turbo Mobule that allows you to scan anything and get results in form of JPG or PDF
Made with:
- iOS - VisionKit (VNDocumentCameraViewController)
- Android - ML Kit GmsDocumentScanning (only for Google Play services)
Installation
Install via yarn or npm, example:
yarn add react-native-docs-scanner
Install pods:
cd ./ios && pod install
Add camera usage description to Info.plist, example:
<key>NSCameraUsageDescription</key>
<string>This app uses camera to scan documents</string>Design
Module exposes 3 methods:
- scan - start scanning
- getScans - get all previously cached scans (caches can be cleared automatically by system, do not rely on this as a source of truth)
- clearScans - clear all cached scan
Moreover, scan method allows you to configure options for scanner:
- resultFormat - configure scanner result to return PDF or JPG (Default JPG)
Android only options (see GmsDocumentScannerOptions):
- pageLimit
- allowGalleryImport
- scannerMode
Usage
JPG result:
const result = await DocsScanner.scan();
setPages(result.pages);PDF result:
const result = await DocsScanner.scan({
resultFormat: ScannerResultFormat.PDF
});
setPages(result.pages);Contributing
License
MIT
Made with create-react-native-library
