cordova-plugin-dynamsoft-barcode-reader v1.5.8
cordova-plugin-dynamsoft-barcode-reader
Dynamsoft Barcode Reader SDK for Cordova.
Supported Platforms
- Android
- iOS
How to use
Install the plugin
$ cordova plugins add cordova-plugin-dynamsoft-barcode-readerOr:
$ cordova plugins add https://github.com/xulihang/cordova-plugin-dynamsoft-barcode-reader.gitMethods
initInitialize Dynamsoft Barcode Reader with a valid license. You can apply for a trial license here.
cordova.plugins.DBR.init(license,successCallback,errorCallback);decodeDecode base64 and return results
cordova.plugins.DBR.decode(base64,successCallback,errorCallback);A result object has the following properties:
barcodeText,barcodeBytesBase64barcodeFormatand localization results:x1,y1,x2,y2,x3,y3,x4,y4.initRuntimeSettingsWithStringSet runtime settings with JSON template
cordova.plugins.DBR.initRuntimeSettingsWithString(template,onInitSettings);A sample template which specifies the barcode format as QR code:
{ "ImageParameter": { "BarcodeFormatIds": [ "BF_QR_CODE" ], "BinarizationModes": [ { "BlockSizeX": 61, "BlockSizeY": 61, "LibraryFileName": "", "LibraryParameters": "", "Mode": "BM_LOCAL_BLOCK" } ], "Description": "", "ExpectedBarcodesCount": 1, "Name": "Settings", "Timeout": 99999 }, "Version": "3.0" }outputSettingsToStringOutput the current runtime settings to string.
cordova.plugins.DBR.outputSettingsToString(onOutput);destroyDestroy the current instance of Dynamsoft Barcode Reader.
cordova.plugins.DBR.destroy(success, error);startScanningOpen the camera using Dynamsoft Camera Enhancer and decode frames.
cordova.plugins.DBR.startScanning({"dceLicense":"license","resolution":2}, onScanned, error);The scan options:
interface ScanOptions { dceLicense?: string; rotate?: boolean; //whether to convert the frame to bitmap and rotate it, false by default resolution?: number; // check out the following enum of resolution } enum EnumResolution { RESOLUTION_AUTO = 0, RESOLUTION_480P = 1, RESOLUTION_720P = 2, RESOLUTION_1080P = 3, RESOLUTION_2K = 4, RESOLUTION_4K = 5, }The
onScannedcallback will return the frame resolution, frame rotation and barcode results.stopScanningClose the camera.
cordova.plugins.DBR.stopScanning(success, error);pauseScanningPause the camera.
cordova.plugins.DBR.pauseScanning(success, error);resumeScanningResume the camera.
cordova.plugins.DBR.resumeScanning(success, error);switchTorchTurn on/off the torch. Value of desiredStatus:
on,off.cordova.plugins.DBR.switchTorch(desiredStatus, success, error);setZoomSet the zoom factor of the camera.
cordova.plugins.DBR.setZoom(zoomFactor, success, error);setFocusSet the point to focus for the camera.
cordova.plugins.DBR.setFocus(point, success, error);Point:
{x:number,y:number}getResolutionGet the current video resolution in format like this:
1280x720.cordova.plugins.DBR.getResolution(success, error);
Demo
Ionic Wrapper
@awesome-cordova-plugins/dynamsoft-barcode-scanner
License Versions
For versions >= 1.2.0, License 3 is used.
For versions < 1.2.0, License 1 and 2 are used.
Supported Barcode Symbologies
- Code 11
- Code 39
- Code 93
- Code 128
- Codabar
- EAN-8
- EAN-13
- UPC-A
- UPC-E
- Interleaved 2 of 5 (ITF)
- Industrial 2 of 5 (Code 2 of 5 Industry, Standard 2 of 5, Code 2 of 5)
- ITF-14
- QRCode
- DataMatrix
- PDF417
- GS1 DataBar
- Maxicode
- Micro PDF417
- Micro QR
- PatchCode
- GS1 Composite
- Postal Code
- Dot Code
- PharmaCode
How the plugin is made
Use plugman to create a plugin
$ plugman create --name DBR --plugin_id cordova-plugin-dynamsoft-barcode-reader --plugin_version 0.0.1Add platform
$ plugman platform add --platform_name ios$ plugman platform add --platform_name androidImplement the plugin
Modify the
DBR.java,DBR.mandDBR.jsfiles. Set up the gradle and cocoapods to use the Android aar file and the iOS framework of Dynamsoft Barcode Reader.Create package.json
$ plugman createpackagejson .
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago