Skip to content

Repository files navigation

FacePlugin

🌐 Company Site - Here

🤗 Hugging Face - Here

🛟 Help Center - Here

🐳 Docker Hub - Here

ID Document Recognition SDK — iOS (Fully On-Premise)

Ready in ~10 minutes (after framework download): Unzip docsdk.framework.zip into this folder → Run on a phone Jump: Get the framework · Run the demo · Setup (your own app) · About SDK

Introduction

Explore FacePlugin Document Reader SDK — ID cards, passports, driver licenses with OCR, MRZ and barcode.

This is an on-premise FacePlugin SDK. All processing stays on the device — no biometric data is sent to FacePlugin cloud.

This repository is the iOS demo app — a standalone customer repo. Runtime is docsdk.framework (download from Google Drive). No other FacePlugin repository is required.

◾ Main Functionalities

Feature Supported
ID Card / Passport / Driver License
MRZ / Barcode / QR / OCR
Document detection & classification
Auto-capture & image quality

◾ Product List

Platform Repository
Android ID-Document-Recognition-Android
iOS ID-Document-Recognition-iOS
Windows ID-Document-Recognition-Windows
Linux / Docker ID-Document-Recognition

Before you start

Step What you need
1 Xcode 15+ and a real device (simulator is not recommended)
2 docsdk.framework in this folder — see Get the framework
3 Demo license is already in the repo (licenseKey for com.faceplugin.documentreader.app). Request a new key only if you change the bundle identifier — see SDK License

You can run the sample app as-is. Camera and gallery unlock when the status bar shows Ready.

System requirements

Item Minimum Recommended
iOS 13.0 16 or newer
Device iPhone with A12 or newer Recent iPhone
RAM 4 GB 6 GB or more
Camera Rear camera Auto-focus, 1080p
Device Physical device Same; simulator is not for camera

Get the framework (docsdk.framework)

docsdk.framework is a header stub on GitHub because the binary is too large. On Drive it is shipped as **docsdk.framework.zip** — unzip after you download.

Where to download

DocumentReader-iOS-App runtime (Google Drive) — file: docsdk.framework.zip

How to place it

  1. Clone this repo (if you have not already):
git clone https://github.com/Faceplugin-ltd/ID-Document-Recognition-iOS.git
cd ID-Document-Recognition-iOS
  1. Download **docsdk.framework.zip** from the Drive folder.
  2. Unzip it (double-click in Finder, or unzip docsdk.framework.zip). You should get a docsdk.framework folder — not the .zip.
  3. Put **docsdk.framework** here (repo root, next to DocumentReader.xcodeproj — not in a nested folder, and not the zip file):
ID-Document-Recognition-iOS/
├── DocumentReader.xcodeproj
├── DocumentReader/
└── docsdk.framework/                 ← unzipped (not .zip; engine is nested as Frameworks/dcrcore.framework)

If unzip creates docsdk.framework in Downloads, move that folder into this repo. You can delete the .zip afterward.

Run the demo

  1. Open DocumentReader.xcodeproj in Xcode.
  2. Set your Team for signing. Bundle ID is com.faceplugin.documentreader.app.
  3. Run on a device. The demo already has a valid licenseKey for com.faceplugin.documentreader.app.

The status bar at the bottom of the home screen is the SDK status (Loading native SDK…Ready). Camera and From Gallery stay disabled until it shows Ready. Home tiles are one row under the title: Camera | Gallery | About. Camera shows the live overlay; tap Capture when the score is ready (≥ 50%).

Screenshots

Home — Camera, Gallery, About   Camera — live document overlay and Capture   Result — extracted OCR / MRZ fields

SDK License

Licenses are offline and bound to your app identifier.

The sample app already includes a valid key for com.faceplugin.documentreader.app. You only need a new key if you use a different bundle identifier.

How to get a license

The code below shows how to use the license:

private let licenseKey =
"FP1.RlBMMQMAAQAZ9Zwi8fHG33dpwB8MAgAAugTVCCTnRx8neRXi7q3IQx09+pM/07ZLOE3uhGCXIfQq/jt8i6+oovCghJsTnzx+LbraSzYnYKhFM+8ZpCt5x6/YNgVNh2Wrdq336ehT9ZmWagxWEm/T4sJw0IlrJwxz+uDS01X95P0og2hQy61Rqh6Q2lCsRpBVj6tVpVU7Q4BcnL43JHUZyFIFzZVhgakFrzZ1v2yMX7hZubx1vsVTDS8XZjOEjNyIs2B7th1XczBQV9jRo/Hzq9IFypKxF+w0kqKeiCGgXtEkpVnhH0q2d3Ol3Hwd7VCvN4rwAfXA4LRpBqMMXgN0iFb4GaZ/5RrcuiWGHt6Se1XRdLaVcYeiafY9i0dGnKpWoYC6Wcc3w7Ud9tt/JH3ZCW0VSX3mhbwizb9aUFpfewQ1233B2QkyydYrmcW9WdRyuIITCZl7lxL4Bu+rMuNvYImrbjnPtUMErhwldzp5/KpVD2n8ZuhQVqo/nvxKVkhu49jA5rncA99rBR/j8PA8tQnrkJA/UzbnGZKe5vaUZHHbc2f/8hoyFAd+bYsgWBBGm98d/JoFNeKA/Lj9qBz/96Vhsb31X/g69Mg2FjeKLmPNLRBsdtB5Gq451Ng7SqVBhSLu3izjcEPw0ZNvfgp41+RXMoxr3HrJ0Nrxe+DjbsVVEhXboNK5UoW0K+YwDpRBssLUBD2v0A5O46pNVDj8BjG6P26LADCBiAJCAUUBMF7fdBJVN4bynNDBBmW66ebB8UiHQWqr3JXWGS4yX+ANEOKFA8x241i0loqcmVGGkNRTdDEuE8T4WaDU9WqBAkIAsgWLPid1PUQVJZVceswxeHuK+NkbA4temoT2sYADekl3tZEA2YA4Ax8Z02A3xY1cT7gAnQz6fMxwoRmYKzZevDQ="

let machine = DocSDK.getMachineCode()
let act = Int(DocSDK.setActivation(self.licenseKey))
let initRc = act == 0 ? Int(DocSDK.initSDK()) : act

Please contact us to get the license.

Setup (your own app)

You only need docsdk.framework and DocSDK. You do not need this demo’s ViewController / CameraViewController.

  1. Copy docsdk.framework into your project root.
  2. In Xcode: General → Frameworks, Libraries, and Embedded Content → add it (Embed & Sign).
  3. Add a bridging header (Swift):
#import <docsdk/DocSDK.h>

Project Navigator → Build Settings → Swift Compiler - General → Objective-C Bridging Header.

The license is bound to your bundle identifier. Request a key for that id, not the demo’s.

Call initSDK and all process methods off the main thread.

About SDK

// Bridging header: #import <docsdk/DocSDK.h>

Call initSDK and process methods off the main thread. 0 = DocSDKSuccess. Process methods return JSON.

Activate and init

DispatchQueue.global(qos: .userInitiated).async {
    var ret = DocSDK.setActivation("FP1.…")
    if ret == 0 {
        ret = DocSDK.initSDK()
    }
}

Gallery — one image

let json = DocSDK.recognize(image)

Gallery — front and back

let json = DocSDK.recognizeFront(front, back: back, authenticity: true) // back may be nil

Camera overlay (no OCR)

let json = DocSDK.locateDocument(frame)
let data = Data(json.utf8)
let obj = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
let score = obj?["score"] as? Double ?? 0
let corners = (obj?["position"] as? [String: Any])?["corners"]

Camera capture (OCR)

let json = DocSDK.recognize(still)

Document authenticity (optional)

let json = DocSDK.documentAuthenticity(image)

Unload

DocSDK.deinitSDK()

Result JSON

{
  "errorCode": 0,
  "documentName": "United States - California Driving License (2017) Real",
  "ocr": { "dateOfBirth": "" },
  "mrz": { },
  "barcode": { },
  "images": [ { "name": "Portrait", "image": "<jpeg-base64>" } ]
}

SDK codes

Code Constant Status
0 DocSDKSuccess Activate / init OK
1 DocSDKLicenseInvalid Invalid license
2 DocSDKLicenseExpired Expired license
3 DocSDKNotActivated Not activated
4 DocSDKInitFailed Init failed

List of our Products

Contact

faceplugin.comfaceplugin.com

Releases

Packages

Contributors

Languages