@scr2em/capacitor-scanner
v6.0.18
Published
scan codes
Downloads
443
Readme
Capacitor Scanner
scan codes
Install
npm install capacitor-scanner
npx cap syncAPI
startScanning(...)stopScanning()openSettings()capturePhoto(...)checkPermissions()requestPermissions()flipCamera()toggleFlash()addListener('barcodeScanned', ...)addListener('rectangleDetected', ...)removeAllListeners()enableObjectDetection(...)disableObjectDetection()- Type Aliases
- Enums
startScanning(...)
startScanning(options?: ScannerOptions | undefined) => any| Param | Type |
| ------------- | --------------------------------------------------------- |
| options | ScannerOptions |
Returns: any
stopScanning()
stopScanning() => anyReturns: any
openSettings()
openSettings() => anyReturns: any
capturePhoto(...)
capturePhoto(options?: CapturePhotoOptions | undefined) => any| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| options | CapturePhotoOptions |
Returns: any
checkPermissions()
checkPermissions() => anyReturns: any
requestPermissions()
requestPermissions() => anyReturns: any
flipCamera()
flipCamera() => anyReturns: any
toggleFlash()
toggleFlash() => anyReturns: any
addListener('barcodeScanned', ...)
addListener(event: 'barcodeScanned', listenerFunc: (result: BarcodeScannedEvent) => void) => any| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| event | 'barcodeScanned' |
| listenerFunc | (result: BarcodeScannedEvent) => void |
Returns: any
addListener('rectangleDetected', ...)
addListener(event: 'rectangleDetected', listenerFunc: (result: RectangleDetectedEvent) => void) => any| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| event | 'rectangleDetected' |
| listenerFunc | (result: RectangleDetectedEvent) => void |
Returns: any
removeAllListeners()
removeAllListeners() => anyReturns: any
enableObjectDetection(...)
enableObjectDetection({ types }: ObjectDetectionOptions) => any| Param | Type |
| --------- | ------------------------------------------------------------------------- |
| __0 | ObjectDetectionOptions |
Returns: any
disableObjectDetection()
disableObjectDetection() => anyReturns: any
Type Aliases
ScannerOptions
{ formats?: BarcodeFormat[]; cameraDirection?: 'BACK' | 'FRONT'; debounceTimeInMilli?: number }
CapturePhotoOptions
{ /** * The desired quality of the captured image, expressed as a value between 0.0 (lowest quality, smallest file size) * and 1.0 (highest quality, largest file size). Defaults to 1.0. * This parameter directly influences the compression level of the resulting JPEG image. */ qualityRatio?: number; }
CapturePhotoResult
{ imageBase64: string }
PermissionsResult
{ camera: 'prompt' | 'denied' | 'granted' }
FlashResult
{ enabled: boolean }
BarcodeScannedEvent
{ scannedCode: string; format: string }
RectangleDetectedEvent
{ detected: true }
ObjectDetectionOptions
{ types: ('barcode' | 'businessCard')[], /** * Optional padding ratio to apply around detected rectangles when cropping. * Value must be between 0 and 1, where: * - 0 = no padding * - 1 = 100% padding (not recommended) * Default is 0.01 (1%) if not specified. */ paddingRatio?: number }
Enums
BarcodeFormat
| Members | Value |
| ---------------- | -------------------------- |
| Aztec | 'AZTEC' |
| Code39 | 'CODE_39' |
| Code93 | 'CODE_93' |
| Code128 | 'CODE_128' |
| DataMatrix | 'DATA_MATRIX' |
| Ean8 | 'EAN_8' |
| Ean13 | 'EAN_13' |
| Itf14 | 'ITF14' |
| Pdf417 | 'PDF_417' |
| QrCode | 'QR_CODE' |
| UpcE | 'UPC_E' |
