Develop Secure Code
DocumentScanner Constants
DocumentScanner Data Types
Entity Extraction
getDocumentScanner()
isAvailable()
scan()
isAvailable()Use this function to determine whether DocumentScanner functionality is available.
1import { getDocumentScanner } from 'lightning/mobileCapabilities';
2isAvailable(): BooleanNone.
Returns true when used on a supported device, and false otherwise.
Use this function to disable or hide scan features on platforms where scanning isn’t supported. For example:
1handleGetScannerClick(event) {
2 const myDocumentScanner = getDocumentScanner();
3 if(myDocumentScanner.isAvailable()) {
4 // Perform document scanning operations
5 }
6 else {
7 // DocumentScanner not available, or consuming app hasn’t implemented it
8 // Not running on a device with camera or OCR functionality, etc.
9 // Handle with message, error, beep, and so on
10 }
11}