1. Introduction and requirements

ScanPlus Document Recognition SDK for iOS is a simple to use high level API, providing a collection of classes and functions for scanning and processing documents from your mobile device’s camera or other image sources like your photo library.

Boost your iOS app with the powerful and convenient document scanning and processing features that also drive the #1 scanning app in the iOS app store: Scanbot Pro.

ScanPlus Document Recognition SDK consists of a bunch of modules, each individually licensable or available in license packages.

Currently the following modules are available

  • Document detection in digital images
  • User interface for guided, automatic document scanning using the document detection module
  • Image processing for rotating, cropping, filtering and perspective correction, optimized for the needs of document scanning
  • PDF creation, merge a collection of processed or unprocessed document images and write them into a PDF document with one page per image
  • Optical character recognition, recognize text in document images and create searchable PDF documents with selectable text

ScanPlus Document Recognition SDK supports iOS 8 and higher.

If you need further information or are interested in licensing ScanPlus Document Recognition SDK please contact us: [email protected]

2. Installation

ScanPlus Document Recognition SDK is delivered as an embedded framework, containing all iOS supported 32 and 64 bit simulator and device architectures, bitcode and crash symbols.

For invoice and credit card recognition additional data is required in your project. You can include this data by adding the optional data bundles to your apps bundle.

ScanPlus Document Recognition SDK also contains a little script that prepares the framework and your app when archiving your app for App Store submission. It strips the unnecessary architectures from the frameworks binary, code signs the framework and adds the crash symbols (dSYM) file to your apps archive.

Installing the ScanPlus Document Recognition SDK embedded framework is really easy.

For detailed instructions click here

  • 1. Copy “Resources” folder into your apps project folder
  • 2. Open your app project in Xcode
  • 3. Select your apps build target and add an embedded framework
  • 4. Select ‘Add Other…’
  • 5. Locate and select ScanPlusSDK.framework, Alamofire.framework, GPUImage.framework, opencv2.framework, Rectangle.framework, TesseractOCR.framework, Toast.framework
  • Also select and “ScanPlusMedia.xcassets” and “SearchedFlags.xcassets” files.
  • 6. Check ‘Copy items if needed’ and ‘Create groups’ and hit ‘Finish’
  • 9. Import the frameworks umbrella header in your source code files:

#import <ScanPlusSDK/ScanPlusSDK.h>

or

@import ScanPlusSDK;
or for Swift Projet:
import ScanPlusSDK
You are now ready to use ScanPlus SDK in your code.

3. Used third-party libraries and their licenses

ScanPlusSDK uses the following third-party libraries:

OpenCV 3.1

Copyright © 2014, Itseez. All rights reserved. This library is distributed under the terms of the following license: http://opencv.org/license.html.

G8Tesseract

Copyright @ 2014 Daniele Galiotto. https://github.com/gali8/Tesseract-OCR-iOS This library is distributed under the terms of a MIT License (https://github.com/gali8/Tesseract-OCR-iOS/blob/master/LICENSE.md).

Tesseract 3.04 modified by doo GmbH

Tesseract, maintained by Google (http://code.google.com/p/tesseract-ocr/), is distributed under the Apache 2.0 license (see http://www.apache.org/licenses/LICENSE-2.0).

Leptonica 1.72

Copyright @ 2001-2015, Leptonica, (http://leptonica.org), is distributed under a Creative Commons Attribution 3.0 United States License (see http://creativecommons.org/licenses/by/3.0/us/).

OpenSSL 1.0.2d

Copyright @ 1998-2011 The OpenSSL Project. All rights reserved. (https://www.openssl.org) This library is distributed under the terms of the following license: https://github.com/openssl/openssl/blob/master/LICENSE

4. ScanPlus API Documentation

  • In AppDelegate file, add in method  didFinishLaunchingWithOptions after importing ScanPlus SDK:  ScanPlusSDK.setup()
  • In ViewDidLoad method in your controller:

    ScanPlusSDK.sharedInstance.delegate = self

    After subscribe your controller class to ScanPlusSDKDelegate protocol

       extension ViewController: ScanPlusSDKDelegate {

              func didFinishPickingImage(_ image: UIImage?) {  }

              func progressImageRecognition(_ progress: UInt) {  }

              func didFinishCroppingImage(_ image: UIImage?) { }

              func didEndEditingImage(_ image: UIImage) { }

         }

  • Present share controller

    if let result = result {

            ScanPlusSDK.sharedInstance.presentShareController(inController: self, button: sender, result: result, animated: true, completion: nil)

    }  else  {

    if let newResult = ScanPlusSDK.sharedInstance.getSavedText() {

             ScanPlusSDK.sharedInstance.presentShareController(inController: self, button: sender, result: newResult, animated: true, completion: nil)

        }

    }

  • Present share OCR languages

    ScanPlusSDK.sharedInstance.presentOCRLanguages(inController: self, animated: true, completion: nil)

  • Recognise and present result:

 

ScanPlusSDK.sharedInstance.recognizeImage(image,

                                                                                          resultCompletion: { [unowned self] (result, error) in

                                                                                            

                                                                                            self.result = result

                                                                                            ScanPlusSDK.sharedInstance.dismissProgress()

                                                                                            

                                                    ScanPlusSDK.sharedInstance.presentPreview(with: result,

                                                                                              controller: self,

                                                                                              isWithNavigationBar: true,

                                                                                              animated: true,

                                                                                              completion: nil)

})

 

  • Get saved text: ScanPlusSDK.sharedInstance.getSavedText()
  • Present Editor Controller: ScanPlusSDK.sharedInstance.presentEditor(inController: self, image: image, animated: true, completion: nil)