Latest 0.1.3
Homepage https://github.com/iMhdi/MBDocCapture
License MIT
Platforms ios 10.0
Frameworks CoreGraphics, CoreImage
Authors

Version
License
Platform

MBDocCapture makes it easy to add document scanning functionalities to your iOS app but also image editing (Cropping and contrast enhacement).

Features

  • [x] Doc scanning
  • [x] Photo cropping and enhancement
  • [x] Auto scan

Demo

Requirements

  • Swift 4.2
  • iOS 10.0+

Installation

Cocoapods

CocoaPods is a dependency manager for Cocoa projects.

To integrate MBDocCapture into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
pod 'MBDocCapture'
end

Then, run the following command:

$ pod install

Usage

Swift

  1. Make sure that your view controller conforms to the ImageScannerControllerDelegate protocol:
class YourViewController: UIViewController, ImageScannerControllerDelegate {
// YourViewController code here
}
  1. Implement the delegate functions inside your view controller:
    
    /// Tells the delegate that the user scanned a document.
    ///
    /// - Parameters:
    ///   - scanner: The scanner controller object managing the scanning interface.
    ///   - results: The results of the user scanning with the camera.
    /// - Discussion: Your delegate's implementation of this method should dismiss the image scanner controller.
    func imageScannerController(_ scanner: ImageScannerController, didFinishScanningWithResults results: ImageScannerResults) {
    scanner.dismiss()
    }

/// Tells the delegate that the user scanned a document.
///
/// – Parameters:
/// – scanner: The scanner controller object managing the scanning interface.
/// – page1Results: The results of the user scanning page 1.
/// – page2Results: The results of the user scanning page 2.
/// – Discussion: Your delegate’s implementation of this method should dismiss the image scanner controller.
func imageScannerController(_ scanner: ImageScannerController, didFinishScanningWithPage1Results page1Results: ImageScannerResults, andPage2Results page2Results: ImageScannerResults) {
scanner.dismiss()
}

/// Tells the delegate that the user cancelled the scan operation.
///
/// – Parameters:
/// – scanner: The scanner controller object managing the scanning interface.
/// – Discussion: Your delegate’s implementation of this method should dismiss the image scanner controller.
func imageScannerControllerDidCancel(_ scanner: ImageScannerController) {
scanner.dismiss()
}

/// Tells the delegate that an error occured during the user’s scanning experience.
///
/// – Parameters:
/// – scanner: The scanner controller object managing the scanning interface.
/// – error: The error that occured.
func imageScannerController(_ scanner: ImageScannerController, didFailWithError error: Error) {
scanner.dismiss()
}


3. Finally, create and present a `ImageScannerController` instance somewhere within your view controller:

```swift
    let scannerViewController = ImageScannerController(delegate: self)
    //scannerViewController.shouldScanTwoFaces = false // Use this to scan the front and the back of a document 
    present(scannerViewController, animated: true)

License

MBDocCapture is available under the MIT license. See the LICENSE file for more info.

Support

If this project helped you, buy me coffee :coffee:

paypal

Latest podspec

{
    "name": "MBDocCapture",
    "version": "0.1.3",
    "summary": "MBDocCapture makes it easy to add document scanning functionalities to your iOS.",
    "description": "MBDocCapture makes it easy to add document scanning functionalities to your iOS app but also image editing (Cropping and contrast enhacement).",
    "platforms": {
        "ios": "10.0"
    },
    "homepage": "https://github.com/iMhdi/MBDocCapture",
    "swift_version": "4.2",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "El Mahdi BOUKHRIS": "[email protected]"
    },
    "source": {
        "git": "https://github.com/iMhdi/MBDocCapture.git",
        "tag": "0.1.3"
    },
    "source_files": "MBDocCapture/Classes/**/*",
    "resources": "MBDocCapture/**/*.{strings,png}",
    "frameworks": [
        "CoreGraphics",
        "CoreImage"
    ]
}

Pin It on Pinterest

Share This