SDK

Adding the SDK to your project

To add our SDK to your own application, you should add it to the build process of your application. Currently we support doing this using CocoaPods or Carthage.

CocoaPods: Adding the SDK to your Podfile

To add the repository to your project, open the Podfile, if it does not exists, first run pod init in the root of your project with Xcode closed.
Edit the target part of your application in the Podfile, so that it contains the following:

                    
pod 'Klippa-OCR-API', podspec: 'https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaOCRAPI/latest.podspec'
                    
                

The full Podfile might look like this now:

                    
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'TestOcrApiSDK' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestOcrApiSDK
  pod 'Klippa-OCR-API', podspec: 'https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaOCRAPI/latest.podspec'

end
                    
                

When you run pod install now, it should download our library as dependency, and with that all dependencies of our library.
Note: this code always uses the latest version, you can also use a specific version to make sure the SDK won't update without your knowledge.

Carthage: Adding the SDK to your Cartfile

To add the repository to your project, open the Cartfile, if it does not exists, create a Cartfile alongside your .xcodeproj or .xcworkspace.
Add the following to your Cartfile:

                    
binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaOCRAPI.json"
                    
                

When you run carthage update now, it should download our library as dependency, and with that all dependencies of our library.
Note: this code always uses the latest version, you can also use a specific version to make sure the SDK won't update without your knowledge.

Calling the OCR API

Currently the OCR API supports parsing of around 30 templates.

To use the OCR API, generate a Public API key with our API through your own backend, this makes sure your API key won't be leaked and/or abused.

Using the SDK, import our package:

                    
// Add to the top of your file
import KlippaOCRAPI
                    
                

To parse a document (Receipt) with the OCR Api use the following call:

                    
ParsingAPI.parseDocumentWithRequestBuilder(document: url,
                                            url: nil,
                                            template: nil,
                                            pdfTextExtraction: ParsingAPI.PdfTextExtraction_parseDocument(rawValue: "full"),
                                            userData: nil,
                                            userDataSetExternalId: nil,
                                            hashDuplicateGroupId: nil).addHeader(name: "X-Auth-Public-Key", value: publicAPIKey).execute { result in
    <#code#>
}
                     
                

Or call the following for a identity document:

                    
ParsingAPI.parseDocumentIdentityDocumentWithRequestBuilder(document: url,
                                                           url: nil,
                                                           template: nil,
                                                           pdfTextExtraction: ParsingAPI.PdfTextExtraction_parseDocumentIdentityDocument(rawValue: "full"),
                                                           userData: nil,
                                                           userDataSetExternalId: nil,
                                                           hashDuplicateGroupId: nil).addHeader(name: "X-Auth-Public-Key", value: publicAPIKey).execute { result in
    <#code#>
}
                     
                

Versions

The following versions are available:

Versions Table
Version Podspec include URL Cartfile dependency Binary download
0.1.1 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaOCRAPI/0.1.1.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaOCRAPI.json" == 0.1.1 Fat framework (.xcarchive) | XCFramework
0.1.0 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaOCRAPI/0.1.0.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaOCRAPI.json" == 0.1.0 Fat framework (.xcarchive) | XCFramework
0.0.4 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaOCRAPI/0.0.4.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaOCRAPI.json" == 0.0.4 Fat framework (.xcarchive) | XCFramework
0.0.3 https://custom-ocr.klippa.com/sdk/ios/specrepo/ExampleUsername/ExamplePassword/KlippaOCRAPI/0.0.3.podspec binary "https://custom-ocr.klippa.com/sdk/ios/carthage/ExampleUsername/ExamplePassword/KlippaOCRAPI.json" == 0.0.3 Fat framework (.xcarchive) | XCFramework

Changelog