Static
launchOptional
config: BarcodeScanConfig(optional) Configuration parameters for the barcode scanner, including:
license
(string): Dynamsoft license key. If empty, the license is not set.barcodeFormats
(EnumBarcodeFormat): Numeric representation of barcode formats, default is EnumBarcodeFormat.BF_DEFAULT
.
Note that if templateContent or templateNodeRequire is set, barcodeFormats will not take effect.templateFile
- The content of the template as a json string.templateNodeRequire
- The template node require object.scanRegion
(DSRect): Configuration for the scan region. Optional.isTorchButtonVisible
(boolean): Whether to display the torch button, default is true
.isBeepEnabled
(boolean): Whether to enable the beep sound on successful scan, default is false
.isAutoZoomEnabled
(boolean): Whether to enable auto-zoom, default is false
.isCloseButtonVisible
(boolean): Whether to display the close button, default is true
.isScanLaserVisible
(boolean): Whether to display the scan laser line, default is false
.scanningMode
(EnumScanningMode): Scanning mode, default is EnumScanningMode.SM_SINGLE. When set to EnumScanningMode.SM_MULTIPLE, expectedBarcodesCount
and maxConsecutiveStableFramesToExit
are effective.expectedBarcodesCount
(number): Expected number of barcodes to be scanned. Effective only when scanningMode
is set to EnumScanningMode.SM_MULTIPLE.
When the number of scanned barcodes is greater than or equal to this value, the scanning process will exit immediately and return the results, default is 999
.maxConsecutiveStableFramesToExit
(number): Number of consecutive stable frames with the same number of barcode results to exit scanning. Effective only when scanningMode
is set to EnumScanningMode.SM_MULTIPLE, default is 5
.A Promise that resolves with the scan result as a BarcodeScanResult
object.
null
.
Starts the barcode scanner by launching a new page (Activity on Android or ViewController on iOS).
This function initiates the barcode scanning process by launching a new page dedicated to scanning. It accepts an optional configuration object to customize the scanning behavior. If no configuration is provided, it uses a default configuration. The function returns a Promise that resolves with the scan result or rejects with an error if the scanning process fails.
For Android, this function starts an Activity that handles the barcode scanning. For iOS, it presents a ViewController for the same purpose. After scanning, the function handles the result and closes the scanning page if necessary.