Skip to content

GoApptiv/goapptiv_document_scanner

Repository files navigation

GoApptiv Document Scanner

A Document scanner plugin for scanning of invoice and KYC documents with edge detection and cropping facility.

Installation

Get the package

goapptiv_document_scanner:
  git:
    url: https://github.com/GoApptiv/goapptiv_document_scanner.git
    ref: main

Usage/Examples

iOS

iOS 13.0 or higher is needed to use the plugin. Change the minimum platform version to 13 (or higher) in your ios/Podfile file.

iOS 13.0 or higher is needed to use the plugin. If compiling for any version lower than 13.0 make sure to check the iOS version before using the plugin. Change the minimum platform version to 13 (or higher) in your ios/Podfile file, and inform/request access to the permissions acording with permission_handler

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

        ## dart: PermissionGroup.camera
         'PERMISSION_CAMERA=1',

        ## dart: PermissionGroup.photos
         'PERMISSION_PHOTOS=1',
      ]

    end
    # End of the permission_handler configuration
  end
end

Fix build on xCode 15

Add this line to your Podfile in your project:

pod 'WeScan', :path => '.symlinks/plugins/goapptiv_document_scanner/ios/WeScan-3.0.0'

=> like this below:

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'WeScan', :path => '.symlinks/plugins/edge_detection/ios/WeScan-3.0.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

Add below permission to the ios/Runner/Info.plist:

  • one with the key Privacy - Camera Usage Description and a usage description.

Or in text format add the key:

<key>NSCameraUsageDescription</key>
<string>Can I use the camera please?</string>

Android

The plugin code is written in kotlin 1.7.10 so the same has to be set to the android project of yours for compilation. Change the kotlin_version to 1.7.10 in your android/build.gradle file.

ext.kotlin_version = '2.1.20'

Change the minimum Android SDK version to 21 (or higher) in your android/app/build.gradle file.

minSdkVersion 24

AndroidManifest permissions

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <!-- Only request storage permissions on Android versions below 33 -->
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="32" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="32" />
    <!-- For Android 13+ (API 33+), use the new photo permissions if needed -->
    <uses-permission
        android:name="android.permission.READ_MEDIA_IMAGES"
        tools:targetApi="33" />
    <uses-permission android:name="android.permission.CAMERA" />
    
    <!-- Other App Components -->
</manifest>

Add dependency:

Please check the latest version before installation.

dependencies:
  flutter:
    sdk: flutter
  goapptiv_document_scanner:
    git:
      url: https://github.com/GoApptiv/goapptiv_document_scanner.git
      ref: main

Add the following imports to your Dart code:

import 'package:goapptiv_document_scanner/goapptiv_document_scanner.dart';
    // Use below code for taking image from camera.
try {
    //Make sure to await the call to GetPicture.
    final imagePath = await GoapptivDocumentScanner.getPicture();
} catch (e) {
    print(e);
}
// Use below code for selecting directly from the gallery.
try {
    //Make sure to await the call to getPictureFromGallery.
    final imagePath = await GoapptivDocumentScanner.getPictureFromGallery();
} catch (e) {
    print(e);
}

Authors

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •