Skip to main content

Using the iOS Document Scanner SDK's Cleanup Screen

Overview​

The Scanbot SDK includes a Cleanup Screen to draw over objects and document marks and then remove them from the document. This is particularly useful when users want to remove document artifacts precisely.

The standalone Cleanup Screen is presented with SBSDKUI2DocumentCleanupViewController and configured through SBSDKUI2DocumentCleanupStandaloneConfiguration. It operates on a page of an SBSDKScannedDocument, so add your image to a document first and pass the document and page UUIDs to the configuration. The completion handler returns the UUIDs of the cleaned-up document and page.

Example configuration of the Cleanup Screen​

Using Cleanup Screen
loading...

Cleanup engine configuration options​

Configure the cleanup behavior of the underlying engine through DocumentCleanupConfiguration. In the Ready-to-Use UI, pass it as screens.cleanup.engineConfiguration.

PropertyTypeDefaultDescription
keepTextBooleantrueIf true, the SDK keeps detected text intact while the user erases around it. Text detection runs once up front and can take a moment, so construct the cleanup pipeline asynchronously to keep the UI responsive.
maxUndoRedoStackSizeInt3How many undo and redo steps the SDK keeps in memory. 0 turns off undo and redo. When the limit is exceeded, the oldest steps can no longer be undone.
maxCleanupResolutionInt0Caps the brushed area the SDK processes in one cleanup step, as width × height in pixels. Larger areas are processed at a lower resolution and scaled back up, which saves memory but can soften the edges near the stroke. 0 means no limit. For example, 1200000 keeps peak memory at about 0.5 GB for a 12 MP image. Prefer cleaning smaller areas over relying on this limit.
maxMaskBoundingBoxAreaInt600000Caps the area of the bounding box around the brushed mask, as width × height in pixels. If the mask is larger, the SDK skips the cleanup and returns the unchanged image with the status ERROR_MASK_TOO_LARGE. The undo and redo history stays as it is. Unlike maxCleanupResolution, this limit rejects the mask instead of lowering the quality, so you can ask the user to select a smaller area. 0 means no limit.

Want to scan longer than one minute?

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

Get free trial license