Skip to content
MBDocCapture makes it easy to add document scanning functionalities to your iOS app but also image editing (Cropping and contrast enhacement).
Branch: master
Clone or download
Mahdi
Latest commit 6b5cc2b May 3, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example <FIX> Ressources loading May 3, 2019
MBDocCapture <FIX> Ressources loading May 3, 2019
.gitignore initial import Apr 22, 2019
.travis.yml initial import Apr 22, 2019
LICENSE initial import Apr 22, 2019
MBDocCapture-demo.gif initial import Apr 22, 2019
MBDocCapture.podspec <FIX> Ressources loading May 3, 2019
README.md Update README.md Apr 24, 2019
_Pods.xcodeproj initial import Apr 22, 2019

README.md

MBDocCapture

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

  • Doc scanning
  • Photo cropping and enhancement
  • 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()
}
  1. Finally, create and present a ImageScannerController instance somewhere within your view controller:
    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 ☕️

paypal

You can’t perform that action at this time.