> For the complete documentation index, see [llms.txt](https://api2-ekycapis.innov8tif.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api2-ekycapis.innov8tif.com/okaycam-mobile-sdk/okaycam-plus-mobile-sdk/okaycam-plus-ios/development-guide-document-capture.md).

# Development Guide (Document Capture)

### Document Capture

1. Instantiate the configuration object. You must pass a reference to your navigation controller.

```swift
let config = OkayCamConfig(navigationController: nav)
```

The configuration object is initialized with default values.

2. Start the process by calling `start` on `OkayCamDoc` class. You can handle the result in the completion handler.

```swift
OkayCamDoc.start(
    okayCamConfig: config,
    license: yourLicense,
    { filePaths, error in
        // handle
    }
)
```

You will only either receieve `filePaths` or an `error`. One will be valid and the other will be `nil`.

### **Configuration**

Modifying the configuration object:

```swift
        let config = OkayCamConfig(navigationController: nav)
        config.topLabel.text = "top label text"
        config.topLabel.color = .green
        config.topLabel.size = 14
        config.bottomLabel.text = "bottom label text"
        config.bottomLabel.color = .systemPink
        config.bottomLabel.size = 20
        config.frame.color = .blue
        config.frame.size = CGSize(width: 230, height: 100)
        config.frame.content = URL(fileURLWithPath: Bundle.main.path(forResource: "image", ofType: "svg")!)
        config.showOverlay = false
        config.timer.backgroundColor = .magenta
        config.timer.textColor = .systemTeal
        config.captureBtnColor = .white
        config.torchBtnEnabled = false
        config.confirmBtnConfig.backgroundColor = .blue
        config.confirmBtnConfig.contentColor = .black
        config.retakeBtnConfig.backgroundColor = .orange
        config.retakeBtnConfig.contentColor = .black
        config.captureConfigPair = CaptureConfigPair(
            firstPhoto: OkayCamCaptureConfig(
                timeOut: 2,
                onFlash: false, 
                onImageQuality: false, // Required for SDK >= 2.0.0
                outputPath: myCustomFilePath
            ),
            secondPhoto: OkayCamCaptureConfig(
                timeOut: 1,
                onFlash: false, 
                onImageQuality: false, // Required for SDK >= 2.0.0
                outputPath: myCustomFilePath
            )
        )
        config.crop = true
        config.width = 250
        config.imageQuality = 1.0
```

Properties on `OkayCamConfig`:

| Property                                                                 | Default                                                                                                                                        | Type                 |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| topLabel                                                                 | `OkayCamLabelConfig(text: "Tap to focus", color: UIColor.white, size: CGFloat(24))`                                                            | `OkayCamLabelConfig` |
| bottomLabel                                                              | `OkayCamLabelConfig(text: "Please align ID card within frame", color: UIColor.white, size: CGFloat(24))`                                       | `OkayCamLabelConfig` |
| frame                                                                    | `OkayCamFrameConfig(size: nil, color: .white, content: nil)`                                                                                   | `OkayCamFrameConfig` |
| showOverlay                                                              | `true`                                                                                                                                         | `Bool`               |
| timer                                                                    | `OkayCamTimerConfig(backgroundColor: UIColor.black, textColor: UIColor.white)`                                                                 | `OkayCamTimerConfig` |
| captureBtnColor                                                          | `UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0)`                                                                                      | `UIColor`            |
| torchBtnEnabled                                                          | `false`                                                                                                                                        | `Bool`               |
| confirmBtnConfig                                                         | `OkayCamBtnConfig(backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0), contentColor: UIColor.white)`                      | `OkayCamBtnConfig`   |
| retakeBtnConfig                                                          | `OkayCamBtnConfig(backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0), contentColor: UIColor.white)`                      | `OkayCamBtnConfig`   |
| **SDK version 1.1.13 <=** **or SDK version 1.1.15 >=** captureConfigPair | `CaptureConfigPair(firstPhoto: OkayCamCaptureConfig(timeOut: 0, onFlash: false, outputPath: nil), secondPhoto: nil)`                           | `CaptureConfigPair`  |
| crop                                                                     | `false`                                                                                                                                        | `Bool`               |
| width                                                                    | `nil`                                                                                                                                          | `Int?`               |
| imageQuality                                                             | `1.0 (range 0 - 1.0)`                                                                                                                          | `CGFloat`            |
| frameSize                                                                | `nil`                                                                                                                                          |                      |
| autoCapture                                                              | <p></p><p><code>False</code> will disable autoCapture for documents.</p><p></p><p><code>True</code> will enable autocapture for documents.</p> | `Bool`               |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api2-ekycapis.innov8tif.com/okaycam-mobile-sdk/okaycam-plus-mobile-sdk/okaycam-plus-ios/development-guide-document-capture.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
