scanbotsdk
    Preparing search index...

    Class DocumentCleanup

    API for document cleanup. *

    • Required licence feature(s): ImageProcessing.

    Since the class is backed by native resources and implements AsyncDisposable it's highly recommended to use the await using syntax when an instance is created to ensure the resource is disposed automatically:

    await using instance = await DocumentCleanup.create(...);
    

    Alternatively, one can explicitly call dispose method to release the native resource. If neither is used, the resource will be released when the instance is garbage collected which is not recommended.

    Implements

    • AsyncDisposable
    Index

    Methods

    • Returns Promise<void>

    • Returns whether a redo operation is currently available.

      • This is true when at least one undo operation has been performed and not yet overwritten by a new cleanup.

      Returns Promise<boolean>

      True if redo is available, false otherwise.

    • Returns whether an undo operation is currently available.

      • This is true when at least one cleanup operation has been performed and not yet fully undone.

      Returns Promise<boolean>

      True if undo is available, false otherwise.

    • As the instance is backed by a native resource, it should be disposed when it is no longer needed. This method will release the native resource. As a recommended alternative since the class implements AsyncDisposable one can use 'await using' syntax to ensure the resource is disposed of automatically. If neither is used, the resource will be released when the instance is garbage collected which is not recommended.

      Returns Promise<void>

      A promise that resolves when the instance is disposed.

    • Re-applies the last undone cleanup operation.

      • If no operations are available to redo, returns the current image unchanged.
      • Performing a new cleanup operation after undo will clear the redo history.

      Returns Promise<ImageRef>

      Image with last undone operation re-applied, or current image if no operations to redo.

    • Restores the original image, and clears the undo/redo history.

      • After reset, both canUndo and canRedo return false.

      Returns Promise<ImageRef>

      The original, unmodified image.

    • Reverts the last cleanup operation.

      • If no operations are available to undo, returns the current image unchanged.
      • The number of available undo operations is limited by maxUndoRedoStackSize.
      • When the operation limit is exceeded, the oldest operations cannot be undone.

      Returns Promise<ImageRef>

      Image with last operation reverted, or current image if no operations to undo.

    • Initializes the document cleanup.

      • When the keepText option is enabled (see DocumentCleanupConfiguration), text detection will be run, which can be time-consuming.
      • For better user experience, consider running the document cleanup constructor asynchronously.

      Parameters

      Returns Promise<DocumentCleanup>

      Instance of DocumentCleanup.