Barcode scanner with camera zoom
npm install boru-barcode-scanner
npx cap sync
startScan(...)
stopScan()
readBarcodesFromImage(...)
isSupported()
setZoom(...)
enableTorch()
disableTorch()
toggleTorch()
isTorchEnabled()
isTorchAvailable()
checkPermissions()
requestPermissions()
addListener('barcodeScanned', ...)
addListener('scanError', ...)
removeAllListeners()
- Interfaces
- Type Aliases
- Enums
startScan(options?: StartScanOptions | undefined) => Promise<void>
Start scanning for barcodes.
Only available on Android and iOS.
Param | Type |
---|---|
options |
StartScanOptions |
Since: 0.0.1
stopScan() => Promise<void>
Stop scanning for barcodes.
Only available on Android and iOS.
Since: 0.0.1
readBarcodesFromImage(options: ReadBarcodesFromImageOptions) => Promise<ReadBarcodesFromImageResult>
Read barcodes from an image.
Only available on Android and iOS.
Param | Type |
---|---|
options |
ReadBarcodesFromImageOptions |
Returns: Promise<ReadBarcodesFromImageResult>
Since: 0.0.1
isSupported() => Promise<IsSupportedResult>
Returns whether or not the barcode scanner is supported.
Available on Android and iOS.
Returns: Promise<IsSupportedResult>
Since: 0.0.1
setZoom(zoomRatio: any) => Promise<void>
Enable zoom feature during a scan session.
Only available on Android and iOS.
Param | Type |
---|---|
zoomRatio |
any |
Since: 0.0.1
enableTorch() => Promise<void>
Enable camera's torch (flash) during a scan session.
Only available on Android and iOS.
Since: 0.0.1
disableTorch() => Promise<void>
Disable camera's torch (flash) during a scan session.
Only available on Android and iOS.
Since: 0.0.1
toggleTorch() => Promise<void>
Toggle camera's torch (flash) during a scan session.
Only available on Android and iOS.
Since: 0.0.1
isTorchEnabled() => Promise<IsTorchEnabledResult>
Returns whether or not the camera's torch (flash) is enabled.
Only available on Android and iOS.
Returns: Promise<IsTorchEnabledResult>
Since: 0.0.1
isTorchAvailable() => Promise<IsTorchAvailableResult>
Returns whether or not the camera's torch (flash) is available.
Only available on Android and iOS.
Returns: Promise<IsTorchAvailableResult>
Since: 0.0.1
checkPermissions() => Promise<PermissionStatus>
Check camera permission.
Only available on Android and iOS.
Returns: Promise<PermissionStatus>
Since: 0.0.1
requestPermissions() => Promise<PermissionStatus>
Request camera permission.
Only available on Android and iOS.
Returns: Promise<PermissionStatus>
Since: 0.0.1
addListener(eventName: 'barcodeScanned', listenerFunc: (event: BarcodeScannedEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when a barcode is scanned.
Available on Android and iOS.
Param | Type |
---|---|
eventName |
'barcodeScanned' |
listenerFunc |
(event: BarcodeScannedEvent) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
addListener(eventName: 'scanError', listenerFunc: (event: ScanErrorEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when an error occurs during the scan.
Available on Android and iOS.
Param | Type |
---|---|
eventName |
'scanError' |
listenerFunc |
(event: ScanErrorEvent) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
removeAllListeners() => Promise<void>
Remove all listeners for this plugin.
Since: 0.0.1
Prop | Type | Description | Since |
---|---|---|---|
formats |
BarcodeFormat[] |
Improve the speed of the barcode scanner by configuring the barcode formats to scan for. | 0.0.1 |
lensFacing |
LensFacing |
Configure the camera (front or back) to use. | 0.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
barcodes |
Barcode[] |
The detected barcodes. | 0.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
bytes |
number[] |
Raw bytes as it was encoded in the barcode. | 0.0.1 |
cornerPoints |
[[number, number], [number, number], [number, number], [number, number]] |
The four corner points of the barcode in clockwise order starting with top-left. This property is currently only supported by the startScan(...) method. |
0.0.1 |
displayValue |
string |
The barcode value in a human readable format. | 0.0.1 |
format |
BarcodeFormat |
The barcode format. | 0.0.1 |
rawValue |
string |
The barcode value in a machine readable format. | 0.0.1 |
valueType |
BarcodeValueType |
The barcode value type. | 0.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
formats |
BarcodeFormat[] |
Improve the speed of the barcode scanner by configuring the barcode formats to scan for. | 0.0.1 |
path |
string |
The local path to the image file. | 0.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
supported |
boolean |
Whether or not the barcode scanner is supported. | 0.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
enabled |
boolean |
Whether or not the torch is enabled. | 0.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
available |
boolean |
Whether or not the torch is available. | 0.0.1 |
Prop | Type | Since |
---|---|---|
camera |
CameraPermissionState |
0.0.1 |
Prop | Type |
---|---|
remove |
() => Promise<void> |
Prop | Type | Description | Since |
---|---|---|---|
barcode |
Barcode |
A detected barcode. | 0.0.1 |
Prop | Type | Description | Since |
---|---|---|---|
message |
string |
The error message. | 0.0.1 |
PermissionState | 'limited'
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
Members | Value | Description | Since |
---|---|---|---|
Aztec |
'AZTEC' |
Only available on Android and iOS. | 0.0.1 |
Codabar |
'CODABAR' |
Only available on Android and iOS. | 0.0.1 |
Code39 |
'CODE_39' |
Only available on Android and iOS. | 0.0.1 |
Code93 |
'CODE_93' |
Only available on Android and iOS. | 0.0.1 |
Code128 |
'CODE_128' |
Only available on Android and iOS. | 0.0.1 |
DataMatrix |
'DATA_MATRIX' |
Only available on Android and iOS. | 0.0.1 |
Ean8 |
'EAN_8' |
Only available on Android and iOS. | 0.0.1 |
Ean13 |
'EAN_13' |
Only available on Android and iOS. | 0.0.1 |
Itf |
'ITF' |
Only available on Android and iOS. | 0.0.1 |
Pdf417 |
'PDF_417' |
Only available on Android and iOS. | 0.0.1 |
QrCode |
'QR_CODE' |
Only available on Android and iOS. | 0.0.1 |
UpcA |
'UPC_A' |
Only available on Android and iOS. | 0.0.1 |
UpcE |
'UPC_E' |
Only available on Android and iOS. | 0.0.1 |
Members | Value | Since |
---|---|---|
Front |
'FRONT' |
0.0.1 |
Back |
'BACK' |
0.0.1 |
Members | Value | Since |
---|---|---|
CalendarEvent |
'CALENDAR_EVENT' |
0.0.1 |
ContactInfo |
'CONTACT_INFO' |
0.0.1 |
DriversLicense |
'DRIVERS_LICENSE' |
0.0.1 |
Email |
'EMAIL' |
0.0.1 |
Geo |
'GEO' |
0.0.1 |
Isbn |
'ISBN' |
0.0.1 |
Phone |
'PHONE' |
0.0.1 |
Product |
'PRODUCT' |
0.0.1 |
Sms |
'SMS' |
0.0.1 |
Text |
'TEXT' |
0.0.1 |
Url |
'URL' |
0.0.1 |
Wifi |
'WIFI' |
0.0.1 |
Unknown |
'UNKNOWN' |
0.0.1 |