document_scanner_flutter
A document scanner + PDF generator plugin for Flutter. Supports Android and iOS with auto edge detection, cropping, B&W filter, and PDF generation.
Requirements
Platform
Minimum Version
Android
API 21 (Android 5.0)
iOS
iOS 12.0
Flutter
3.0.0
Dart
2.17.0
Getting Started
Installing
document_scanner_flutter: ^0.4.0
Usage
Basic — Camera or Gallery picker
final File ? scannedDoc = await DocumentScannerFlutter .launch (context);
Specific source
final File ? scannedDoc = await DocumentScannerFlutter .launch (
context,
source: ScannerFileSource .CAMERA,
);
Re-edit an existing image (v0.4.0+)
final Uint8List imageBytes = await myFile.readAsBytes ();
final File ? rescanned = await DocumentScannerFlutter .launch (
context,
source: ScannerFileSource .CAMERA,
initialImage: imageBytes,
canBackToInitial: true ,
);
Recover last scan after crash (v0.4.0+)
final File ? recovered = await DocumentScannerFlutter .retrieveLostData ();
if (recovered != null ) {
}
PDF generation from multiple scans
final File ? pdfFile = await DocumentScannerFlutter .launchForPdf (
context,
source: ScannerFileSource .CAMERA,
);
Labels customization
final File ? scannedDoc = await DocumentScannerFlutter .launch (
context,
source: ScannerFileSource .CAMERA,
labelsConfig: {
ScannerLabelsConfig .ANDROID_NEXT_BUTTON_LABEL: 'Next' ,
ScannerLabelsConfig .ANDROID_SAVE_BUTTON_LABEL: 'Save' ,
ScannerLabelsConfig .ANDROID_ROTATE_LEFT_LABEL: 'Rotate Left' ,
ScannerLabelsConfig .ANDROID_ROTATE_RIGHT_LABEL: 'Rotate Right' ,
ScannerLabelsConfig .ANDROID_ORIGINAL_LABEL: 'Original' ,
ScannerLabelsConfig .ANDROID_BMW_LABEL: 'B & W' ,
ScannerLabelsConfig .PICKER_CAMERA_LABEL: 'Camera' ,
ScannerLabelsConfig .PICKER_GALLERY_LABEL: 'Gallery' ,
ScannerLabelsConfig .PICKER_CANCEL_LABEL: 'Cancel' ,
ScannerLabelsConfig .ANDROID_INITIAL_IMAGE_LOADING_MESSAGE: 'Loading image...' ,
},
);
Changelog
See CHANGELOG.md for full release history.