Skip to main content

Scanning a document from an image

The Scanbot SDK provides two abstractions to incapsulate scanned documents. Using these you can directly detect document on an image.

SBSDKDocumentPage - This class represents a scanned document page. It contains all the needed information about the scanned page and gives you the ability to manage the scanned image in a variety of ways.

SBSDKDocument - This class represents a thread-safe container for SBSDKDocumentPage instances. It gives the ability to add, remove and replace pages in an array-like fashion.

Both these classes are widely used in all Ready-to-use UI components (more about RTU UI).

Example of detection on the Image

// For this example we're going to create a mock scanned document image.
guard let documentImage = UIImage(named: "documentImage") else { return }

// Create a page with a UIImage instance.
let page = SBSDKDocumentPage(image: documentImage, polygon: nil, filter: .none)

// Return the result of the detected document on an image.
let result = page.detectDocument(applyPolygonIfOkay: true)

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?

On this page

Scroll to top