Skip to main content

Scanning a document from an image | Capacitor Document Scanner

Detect Document on the Image

Runs document detection on the given image.

detectDocument(args:{
imageFileUri: string,
}): Promise<ResultWrapper<DetectDocumentResult>>;

Returns:

  • documentImageFileUri: The URI of the document image file, if something is detected
  • polygon: The array of detected polygon points, if something is detected
  • detectionResult: The status of the detection

Detect Document on the Page

Runs document detection on the given Page.

detectDocumentOnPage(args:{
page: Page,
}): Promise<ResultWrapper<DetectDocumentResult>>;

Returns a new Page object, which will contain the detection status, the polygon points and the cropped image.

Detection Status

  • OK: An acceptable polygon was detected.
  • OK_BUT_TOO_SMALL: A polygon was detected, but its size is too small.
  • OK_BUT_BAD_ANGLES: A polygon was detected, but it has too much perspective distortion.
  • OK_BUT_BAD_ASPECT_RATIO: A polygon was detected, but its aspect ratio should be landscape/portrait but is portrait/landscape.
  • ERROR_NOTHING_DETECTED: No polygon detected at all.
  • ERROR_TOO_DARK: No polygon detected, image too dark.
  • ERROR_TOO_NOISY: No polygon detected, image too noisy (background).

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?