Scan Documents on a Mobile Device

A Lightning web component can use a device’s camera and optical character recognition (OCR) to scan documents. When a document is successfully scanned, text data extracted from the scanned document is returned to the Lightning web component that invoked it. DocumentScanner recognizes printed text and handwritten form factors. However, DocumentScanner provides the most accurate results when scanning printed text compared handwritten text, which varies on the legibility of handwritten characters.

DocumentScanner results are returned in two formats:

  • A simple string of all recognized text, suitable for simple document capture.
  • Structured text data aligned with the scanned image, suitable for interactive processing of document content.

Scanning is performed locally on the mobile device, and doesn't need a network connection. However, DocumentScanner requires access to APIs implemented in platform-native code that are available only within compatible Salesforce mobile apps.

DocumentScanner does not and cannot function when running in a web browser, whether on a desktop or mobile device.

Important