diff --git a/API Reference.url b/API Reference.url index b3a5e549..bc2b1b86 100644 --- a/API Reference.url +++ b/API Reference.url @@ -1,2 +1,2 @@ [InternetShortcut] -URL=https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/?ver=10.2.10 \ No newline at end of file +URL=https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/?ver=10.2.1000 \ No newline at end of file diff --git a/LEGAL.txt b/LEGAL.txt index 7fea86c8..00ec6130 100644 --- a/LEGAL.txt +++ b/LEGAL.txt @@ -9,7 +9,7 @@ This SDK contains parts of following softwares which are used under license. =================================================================================== Zlib. -Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + (C) 1995-2022 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,8 +27,8 @@ Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. - Jean-loup Gailly - Mark Adler + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu =================================================================================== diff --git a/LICENSE b/LICENSE index 6cce8bcf..e7349294 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ Copyright © 2003–2024 Dynamsoft. All Rights Reserved. The use of this software is governed by the Dynamsoft Terms and Conditions. -https://www.dynamsoft.com/barcode-reader/license-agreement/#javascript \ No newline at end of file +URL=https://www.dynamsoft.com/barcode-reader/license-agreement/#javascript \ No newline at end of file diff --git a/README.md b/README.md index 6dcc2656..8c9d855f 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ In this guide, you will learn step by step on how to integrate the DBR-JS SDK in **Popular Examples** - Hello World - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.2.10/hello-world/hello-world.html) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/hello-world.html?ver=10.2.10&utm_source=github) -- Angular App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.2.10/hello-world/angular) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/angular/dist/hello-world/?ver=10.2.10&utm_source=github) +- Angular App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.2.10/hello-world/angular) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/angular/dist/angular/?ver=10.2.10&utm_source=github) - React App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.2.10/hello-world/react) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/react/build/?ver=10.2.10&utm_source=github) - Vue App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.2.10/hello-world/vue) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/vue/dist/?ver=10.2.10&utm_source=github) - PWA App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.2.10/hello-world/pwa) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/pwa/helloworld-pwa.html?ver=10.2.10&utm_source=github) @@ -89,20 +89,20 @@ The complete code of the "Hello World" example is shown below
- + @@ -148,26 +148,26 @@ The complete code of the "Hello World" example is shown below - `Dynamsoft.Core.CoreModule.loadWasm(["dbr"])`: This is an optional code. Used to load wasm resources in advance, reducing latency between video playing and barcode decoding. -- `Dynamsoft.CVR.CaptureVisionRouter.createInstance()`: This method creates a `CaptureVisionRouter` object `router` which controls the entire process in three steps: +- `Dynamsoft.CVR.CaptureVisionRouter.createInstance()`: This method creates a `CaptureVisionRouter` object `cvRouter` which controls the entire process in three steps: - **Retrieve Images from the Image Source** - - `router` connects to the image source through the [ImageSourceAdapter](https://www.dynamsoft.com/capture-vision/docs/core/architecture/input.html#image-source-adapter?lang=js) interface with the method `setInput()`. + - `cvRouter` connects to the image source through the [ImageSourceAdapter](https://www.dynamsoft.com/capture-vision/docs/core/architecture/input.html#image-source-adapter?lang=js) interface with the method `setInput()`. ```js - router.setInput(cameraEnhancer); + cvRouter.setInput(cameraEnhancer); ``` > The image source in our case is a [CameraEnhancer](https://www.dynamsoft.com/camera-enhancer/docs/web/programming/javascript/user-guide/index.html) object created with `Dynamsoft.DCE.CameraEnhancer.createInstance(view)` - **Coordinate Image-Processing Tasks** - - The coordination happens behind the scenes. `router` starts the process by specifying a preset template "ReadSingleBarcode" in the method `startCapturing()`. + - The coordination happens behind the scenes. `cvRouter` starts the process by specifying a preset template "ReadSingleBarcode" in the method `startCapturing()`. ```js - router.startCapturing("ReadSingleBarcode"); + cvRouter.startCapturing("ReadSingleBarcode"); ``` - **Dispatch Results to Listening Objects** - - The processing results are returned through the [CapturedResultReceiver](https://www.dynamsoft.com/capture-vision/docs/core/architecture/output.html#captured-result-receiver?lang=js) interface. The `CapturedResultReceiver` object is registered to `router` via the method `addResultReceiver()`. For more information, please check out [Register a result receiver](#register-a-result-receiver). + - The processing results are returned through the [CapturedResultReceiver](https://www.dynamsoft.com/capture-vision/docs/core/architecture/output.html#captured-result-receiver?lang=js) interface. The `CapturedResultReceiver` object is registered to `cvRouter` via the method `addResultReceiver()`. For more information, please check out [Register a result receiver](#register-a-result-receiver). ```js - router.addResultReceiver({/*The-CapturedResultReceiver-Object"*/}); + cvRouter.addResultReceiver({/*The-CapturedResultReceiver-Object"*/}); ``` - - Also note that reading from video is extremely fast and there could be many duplicate results. We can use a [filter](#filter-the-results-important) with result deduplication enabled to filter out the duplicate results. The object is registered to `router` via the method `addResultFilter()`. + - Also note that reading from video is extremely fast and there could be many duplicate results. We can use a [filter](#filter-the-results-important) with result deduplication enabled to filter out the duplicate results. The object is registered to `cvRouter` via the method `addResultFilter()`. ```js - router.addResultFilter(filter); + cvRouter.addResultFilter(filter); ``` > Read more on [Capture Vision Router](https://www.dynamsoft.com/capture-vision/docs/core/architecture/#capture-vision-router). @@ -208,7 +208,19 @@ To utilize the SDK, the initial step involves including the corresponding resour * `cvr.js` introduces the `CaptureVisionRouter` class, which governs the entire image processing workflow. * `dce.js` comprises classes that offer camera support and basic user interface functionalities. -For simplification, starting from version 10.2.10, we introduced `dbr.bundle.js`. Including this file is equivalent to incorporating all six packages. +For simplification, starting from version 10.0.21, we introduced `dbr.bundle.js`. Including this file is equivalent to incorporating all six packages. + +* dynamsoft-core@3.2.30/dist/core.js +* dynamsoft-license@3.2.21/dist/license.js +* dynamsoft-utility@1.2.20/dist/utility.js +* dynamsoft-barcode-reader@10.2.10/dist/dbr.js +* dynamsoft-capture-vision-router@2.2.30/dist/cvr.js +* dynamsoft-camera-enhancer@4.0.3/dist/dce.js + +Equivalent to +* dynamsoft-barcode-reader-bundle@10.2.1000/dist/dbr.bundle.js + +In the following chapters, we will use `dbr.bundle.js`. #### Use a public CDN @@ -217,48 +229,22 @@ The simplest way to include the SDK is to use either the [jsDelivr](https://jsde - jsDelivr ```html - - - - - - + ``` - Or just +- UNPKG ```html - + ``` -- UNPKG +- In some rare cases (such as some restricted areas), you might not be able to access the CDN. If this happens, you can use the following files for the test. ```html - - - - - - + ``` - Or just - - ```html - - ``` - -In some rare cases (such as some restricted areas), you might not be able to access the CDN. If this happens, you can use the following files for the test. - -- https://download2.dynamsoft.com/packages/dynamsoft-core@3.2.10/dist/core.js -- https://download2.dynamsoft.com/packages/dynamsoft-license@3.2.10/dist/license.js -- https://download2.dynamsoft.com/packages/dynamsoft-utility@1.2.10/dist/utility.js -- https://download2.dynamsoft.com/packages/dynamsoft-barcode-reader@10.2.10/dist/dbr.js -- https://download2.dynamsoft.com/packages/dynamsoft-capture-vision-router@2.2.10/dist/cvr.js -- https://download2.dynamsoft.com/packages/dynamsoft-camera-enhancer@4.0.2/dist/dce.js -- or bundle: https://download2.dynamsoft.com/packages/dynamsoft-barcode-reader@10.2.10/dist/dbr.bundle.js - -However, please **DO NOT** use `download2.dynamsoft.com` resources in a production application as they are for temporary testing purposes only. Instead, you can try hosting the SDK yourself. + However, please **DO NOT** use `download2.dynamsoft.com` resources in a production application as they are for temporary testing purposes only. Instead, you can try hosting the SDK yourself. #### Host the SDK yourself (optional) @@ -270,30 +256,20 @@ Options to download the SDK: [Download Dynamsoft Barcode Reader JavaScript Package](https://www.dynamsoft.com/barcode-reader/downloads/?ver=10.2.10&utm_source=github&product=dbr&package=js) -- yarn +- npm ```cmd - yarn add dynamsoft-core@3.2.10 --save - yarn add dynamsoft-license@3.2.10 --save - yarn add dynamsoft-utility@1.2.10 --save - yarn add dynamsoft-barcode-reader@10.2.10 --save - yarn add dynamsoft-capture-vision-router@2.2.10 --save - yarn add dynamsoft-camera-enhancer@4.0.2 --save - yarn add dynamsoft-capture-vision-std@1.2.0 --save - yarn add dynamsoft-image-processing@2.2.10 --save + npm i dynamsoft-barcode-reader-bundle@10.2.1000 -E + npm i dynamsoft-capture-vision-std@1.2.0 -E + npm i dynamsoft-image-processing@2.2.10 -E ``` -- npm +- yarn ```cmd - npm install dynamsoft-core@3.2.10 --save - npm install dynamsoft-license@3.2.10 --save - npm install dynamsoft-utility@1.2.10 --save - npm install dynamsoft-barcode-reader@10.2.10 --save - npm install dynamsoft-capture-vision-router@2.2.10 --save - npm install dynamsoft-camera-enhancer@4.0.2 --save - npm install dynamsoft-capture-vision-std@1.2.0 --save - npm install dynamsoft-image-processing@2.2.10 --save + yarn add dynamsoft-barcode-reader-bundle@10.2.1000 -E + yarn add dynamsoft-capture-vision-std@1.2.0 -E + yarn add dynamsoft-image-processing@2.2.10 -E ``` Depending on how you downloaded the SDK and how you intend to use it, you can typically include it like this @@ -301,35 +277,13 @@ Depending on how you downloaded the SDK and how you intend to use it, you can ty - From the website ```html - - - - - - - ``` - - Or just - - ```html - + ``` - yarn or npm ```html - - - - - - - ``` - - Or just - - ```html - + ``` *Note*: @@ -402,9 +356,9 @@ To use the SDK, we first create a `CaptureVisionRouter` object. ```javascript Dynamsoft.License.LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"); -let router = null; +let cvRouter = null; try { - router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance(); + cvRouter = await Dynamsoft.CVR.CaptureVisionRouter.createInstance(); } catch (ex) { console.error(ex); } @@ -417,12 +371,12 @@ When creating a `CaptureVisionRouter` object within a function which may be call ```javascript Dynamsoft.License.LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"); -let pRouter = null; // promise of router -let router = null; +let pCvRouter = null; // promise of cvRouter +let cvRouter = null; document.getElementById('btn-scan').addEventListener('click', async () => { try { - router = await (pRouter = pRouter || Dynamsoft.CVR.CaptureVisionRouter.createInstance()); + cvRouter = await (pCvRouter = pCvRouter || Dynamsoft.CVR.CaptureVisionRouter.createInstance()); } catch (ex) { console.error(ex); } @@ -431,7 +385,7 @@ document.getElementById('btn-scan').addEventListener('click', async () => { #### Connect an image source -The `CaptureVisionRouter` object, denoted as `router`, is responsible for handling images provided by an image source. In our scenario, we aim to detect barcodes directly from a live video stream. To facilitate this, we initialize a `CameraEnhancer` object, identified as `cameraEnhancer`, which is specifically designed to capture image frames from the video feed and subsequently forward them to `router`. +The `CaptureVisionRouter` object, denoted as `cvRouter`, is responsible for handling images provided by an image source. In our scenario, we aim to detect barcodes directly from a live video stream. To facilitate this, we initialize a `CameraEnhancer` object, identified as `cameraEnhancer`, which is specifically designed to capture image frames from the video feed and subsequently forward them to `cvRouter`. To enable video streaming on the webpage, we create a `CameraView` object referred to as `view`, which is then passed to `cameraEnhancer`, and its content is displayed on the webpage. @@ -443,7 +397,7 @@ To enable video streaming on the webpage, we create a `CameraView` object referr let view = await Dynamsoft.DCE.CameraView.createInstance(); let cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance(view); document.querySelector("#cameraViewContainer").append(view.getUIElement()); -router.setInput(cameraEnhancer); +cvRouter.setInput(cameraEnhancer); ``` #### Register a result receiver @@ -457,23 +411,23 @@ resultReceiver.onDecodedBarcodesReceived = (result) => { if (result.barcodeResultItems.length > 0) { resultsContainer.textContent = ''; for (let item of result.barcodeResultItems) { - // In this example, the barcode result is shown on the page beneath the video + // In this example, the barcode results are displayed on the page below the video. resultsContainer.textContent += `${item.formatString}: ${item.text}\n\n`; } } }; -router.addResultReceiver(resultReceiver); +cvRouter.addResultReceiver(resultReceiver); ``` You can also write code like this. It is the same. ```javascript const resultsContainer = document.querySelector("#results"); -router.addResultReceiver({ onDecodedBarcodesReceived: (result) => { +cvRouter.addResultReceiver({ onDecodedBarcodesReceived: (result) => { if (result.barcodeResultItems.length > 0) { resultsContainer.textContent = ''; for (let item of result.barcodeResultItems) { - // In this example, the barcode result is shown on the page beneath the video + // In this example, the barcode results are displayed on the page below the video. resultsContainer.textContent += `${item.formatString}: ${item.text}\n\n`; } } @@ -486,17 +440,17 @@ Check out [CapturedResultReceiver](https://www.dynamsoft.com/capture-vision/docs With the setup now complete, we can proceed to process the images in two straightforward steps: -1. Initiate the image source to commence image acquisition. In our scenario, we invoke the `open()` method on `cameraEnhancer` to initiate video streaming and simultaneously initiate the collection of images. These collected images will be dispatched to `router` as per its request. +1. Initiate the image source to commence image acquisition. In our scenario, we invoke the `open()` method on `cameraEnhancer` to initiate video streaming and simultaneously initiate the collection of images. These collected images will be dispatched to `cvRouter` as per its request. 2. Define a preset template to commence image processing. In our case, we utilize the "ReadSingleBarcode" template, specifically tailored for processing images containing a single barcode. ```javascript await cameraEnhancer.open(); -await router.startCapturing("ReadSingleBarcode"); +await cvRouter.startCapturing("ReadSingleBarcode"); ``` *Note*: -* `router` is engineered to consistently request images from the image source. +* `cvRouter` is engineered to consistently request images from the image source. * Various preset templates are at your disposal for barcode reading: | Template Name | Function Description | @@ -522,11 +476,11 @@ When making adjustments to some basic tasks, we often only need to modify [Simpl The preset templates can be updated to meet different requirements. For example, the following code limits the barcode format to QR code. ```javascript -let settings = await router.getSimplifiedSettings("ReadSingleBarcode"); +let settings = await cvRouter.getSimplifiedSettings("ReadSingleBarcode"); settings.barcodeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE; -await router.updateSettings("ReadSingleBarcode", settings); -await router.startCapturing("ReadSingleBarcode"); +await cvRouter.updateSettings("ReadSingleBarcode", settings); +await cvRouter.startCapturing("ReadSingleBarcode"); ``` For a list of adjustable barcode settings, check out [SimplifiedBarcodeReaderSettings](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/interfaces/simplified-barcode-reader-settings.html). @@ -536,36 +490,33 @@ For a list of adjustable barcode settings, check out [SimplifiedBarcodeReaderSet Additionally, we have the option to modify the template to retrieve the original image containing the barcode. ```javascript -let settings = await router.getSimplifiedSettings("ReadSingleBarcode"); +let settings = await cvRouter.getSimplifiedSettings("ReadSingleBarcode"); settings.capturedResultItemTypes |= Dynamsoft.Core.EnumCapturedResultItemType.CRIT_ORIGINAL_IMAGE; -await router.updateSettings("ReadSingleBarcode", settings); -await router.startCapturing("ReadSingleBarcode"); +await cvRouter.updateSettings("ReadSingleBarcode", settings); +await cvRouter.startCapturing("ReadSingleBarcode"); ``` Limit the barcode format to QR code, and retrieve the original image containing the barcode, at the same time. ```javascript -let settings = await router.getSimplifiedSettings("ReadSingleBarcode"); +let settings = await cvRouter.getSimplifiedSettings("ReadSingleBarcode"); settings.capturedResultItemTypes = Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE | Dynamsoft.Core.EnumCapturedResultItemType.CRIT_ORIGINAL_IMAGE; -await router.updateSettings("ReadSingleBarcode", settings); -await router.startCapturing("ReadSingleBarcode"); +await cvRouter.updateSettings("ReadSingleBarcode", settings); +await cvRouter.startCapturing("ReadSingleBarcode"); ``` Please be aware that it is necessary to update the `CapturedResultReceiver` object to obtain the original image. For instance: ```javascript +const EnumCRIT = Dynamsoft.Core.EnumCapturedResultItemType; resultReceiver.onCapturedResultReceived = (result) => { - let barcodes = result.items.filter((item) => - item.type === Dynamsoft.Core.EnumCapturedResultItemType.CRIT_BARCODE - ); + let barcodes = result.items.filter(item => item.type === EnumCRIT.CRIT_BARCODE); if (barcodes.length > 0) { let image = result.items.filter( - (item) => - item.type === - Dynamsoft.Core.EnumCapturedResultItemType.CRIT_ORIGINAL_IMAGE + item => item.type === EnumCRIT.CRIT_ORIGINAL_IMAGE )[0].imageData; // The image that we found the barcode(s) on. } @@ -579,10 +530,10 @@ The SDK is initially configured to process images sequentially without any break > Please bear in mind that in the following code, if an image's processing time is shorter than 500 milliseconds, the SDK will wait for the full 500 milliseconds before proceeding to process the next image. Conversely, if an image's processing time exceeds 500 milliseconds, the subsequent image will be processed immediately upon completion. ```javascript -let settings = await router.getSimplifiedSettings("ReadSingleBarcode"); +let settings = await cvRouter.getSimplifiedSettings("ReadSingleBarcode"); settings.minImageCaptureInterval = 500; -await router.updateSettings("ReadSingleBarcode", settings); -await router.startCapturing("ReadSingleBarcode"); +await cvRouter.updateSettings("ReadSingleBarcode", settings); +await cvRouter.startCapturing("ReadSingleBarcode"); ``` ##### Specify a scan region @@ -590,7 +541,7 @@ await router.startCapturing("ReadSingleBarcode"); You can use the parameter `roi` (region of interest) together with the parameter `roiMeasuredInPercentage` to configure the SDK to only read a specific region on the image frames. For example, the following code limits the reading in the center 25%( = 50% * 50%) of the image frames: ```javascript -let settings = await router.getSimplifiedSettings("ReadSingleBarcode"); +let settings = await cvRouter.getSimplifiedSettings("ReadSingleBarcode"); settings.roiMeasuredInPercentage = true; settings.roi.points = [ { x: 25, y: 25 }, @@ -598,8 +549,8 @@ settings.roi.points = [ { x: 75, y: 75 }, { x: 25, y: 75 }, ]; -await router.updateSettings("ReadSingleBarcode", settings); -await router.startCapturing("ReadSingleBarcode"); +await cvRouter.updateSettings("ReadSingleBarcode", settings); +await cvRouter.startCapturing("ReadSingleBarcode"); ``` While the code above accomplishes the task, a more effective approach is to restrict the scan region directly at the image source, as demonstrated in the following code snippet. @@ -627,10 +578,10 @@ You can set the maximum time allowed for processing a single image with the prop > Please be aware that the SDK will cease processing an image if its processing time exceeds the duration specified by the `timeout` parameter. It should not be confused with the previously discussed parameter, `minImageCaptureInterval`. ```javascript -let settings = await router.getSimplifiedSettings("ReadSingleBarcode"); +let settings = await cvRouter.getSimplifiedSettings("ReadSingleBarcode"); settings.timeout = 500; -await router.updateSettings("ReadSingleBarcode", settings); -await router.startCapturing("ReadSingleBarcode"); +await cvRouter.updateSettings("ReadSingleBarcode", settings); +await cvRouter.startCapturing("ReadSingleBarcode"); ``` --> @@ -643,8 +594,8 @@ The preset templates have a lot more settings that can be customized to best sui Upon completing the template editing, you can invoke the `initSettings` method and provide it with the template path as an argument. ```javascript -await router.initSettings("PATH-TO-THE-FILE"); //e.g. "https://your-website/ReadSingleBarcode.json") -await router.startCapturing("ReadSingleBarcode"); // Make sure the name matches one of the CaptureVisionTemplates in the +await cvRouter.initSettings("PATH-TO-THE-FILE"); //e.g. "https://your-website/ReadSingleBarcode.json") +await cvRouter.startCapturing("ReadSingleBarcode"); // Make sure the name matches one of the CaptureVisionTemplates in the json file. ``` #### Filter the results (Important) @@ -656,7 +607,7 @@ While processing video frames, it's common for the same barcode to be detected m ```js let filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter(); filter.enableResultCrossVerification("barcode", true); -await router.addResultFilter(filter); +await cvRouter.addResultFilter(filter); ``` *Note*: @@ -668,7 +619,7 @@ await router.addResultFilter(filter); ```js let filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter(); filter.enableResultDeduplication("barcode", true); -await router.addResultFilter(filter); +await cvRouter.addResultFilter(filter); ``` *Note*: @@ -684,7 +635,7 @@ Under certain circumstances, this duration can be extended with the method `setD ```js let filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter(); filter.setDuplicateForgetTime(5000); // Extend the duration to 5 seconds. -await router.addResultFilter(filter); +await cvRouter.addResultFilter(filter); ``` You can also enable both options at the same time: @@ -694,7 +645,7 @@ let filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter(); filter.enableResultCrossVerification("barcode", true); filter.enableResultDeduplication("barcode", true); filter.setDuplicateForgetTime(5000); -await router.addResultFilter(filter); +await cvRouter.addResultFilter(filter); ``` #### Add feedback @@ -710,7 +661,7 @@ resultReceiver.onDecodedBarcodesReceived = (result) => { Dynamsoft.DCE.Feedback.beep(); } }; -router.addResultReceiver(resultReceiver); +cvRouter.addResultReceiver(resultReceiver); ``` ### Customize the UI diff --git a/dist/DBR-PresetTemplates.json b/dist/DBR-PresetTemplates.json deleted file mode 100644 index 08093841..00000000 --- a/dist/DBR-PresetTemplates.json +++ /dev/null @@ -1,625 +0,0 @@ -{ - "CaptureVisionTemplates": [ - { - "Name": "Default" - }, - { - "Name": "ReadBarcodes_Default", - "ImageROIProcessingNameArray": [ - "roi-read-barcodes" - ], - "Timeout": 10000 - }, - { - "Name": "ReadBarcodes_SpeedFirst", - "ImageROIProcessingNameArray": [ - "roi-read-barcodes-speed-first" - ], - "Timeout": 10000 - }, - { - "Name": "ReadBarcodes_ReadRateFirst", - "ImageROIProcessingNameArray": [ - "roi-read-barcodes-read-rate" - ], - "Timeout": 100000 - }, - { - "Name": "ReadSingleBarcode", - "ImageROIProcessingNameArray": [ - "roi-read-single-barcode" - ], - "Timeout": 10000 - }, - { - "Name": "ReadBarcodes_Balance", - "ImageROIProcessingNameArray": [ - "roi-read-barcodes-balance" - ], - "Timeout": 100000 - }, - { - "Name": "ReadDenseBarcodes", - "ImageROIProcessingNameArray": [ - "roi-read-barcodes-dense" - ], - "Timeout": 10000 - }, - { - "Name": "ReadDistantBarcodes", - "ImageROIProcessingNameArray": [ - "roi-read-barcodes-distant" - ], - "Timeout": 10000 - } - ], - "TargetROIDefOptions": [ - { - "Name": "roi-read-barcodes", - "TaskSettingNameArray": [ - "task-read-barcodes" - ] - }, - { - "Name": "roi-read-barcodes-speed-first", - "TaskSettingNameArray": [ - "task-read-barcodes-speed-first" - ] - }, - { - "Name": "roi-read-barcodes-read-rate", - "TaskSettingNameArray": [ - "task-read-barcodes-read-rate" - ] - }, - { - "Name": "roi-read-single-barcode", - "TaskSettingNameArray": [ - "task-read-single-barcode" - ] - }, - { - "Name": "roi-read-barcodes-balance", - "TaskSettingNameArray": [ - "task-read-barcodes-balance" - ] - }, - { - "Name": "roi-read-barcodes-dense", - "TaskSettingNameArray": [ - "task-read-barcodes-dense" - ] - }, - { - "Name": "roi-read-barcodes-distant", - "TaskSettingNameArray": [ - "task-read-barcodes-distant" - ] - } - ], - "BarcodeFormatSpecificationOptions": [ - { - "Name": "bfs1", - "BarcodeFormatIds": [ - "BF_PDF417", - "BF_QR_CODE", - "BF_DATAMATRIX", - "BF_AZTEC", - "BF_MICRO_QR", - "BF_MICRO_PDF417", - "BF_DOTCODE" - ], - "MirrorMode": "MM_BOTH" - }, - { - "Name": "bfs2", - "BarcodeFormatIds": [ - "BF_ALL" - ], - "MirrorMode": "MM_NORMAL" - }, - { - "Name": "bfs1-speed-first", - "BaseBarcodeFormatSpecification": "bfs1" - }, - { - "Name": "bfs2-speed-first", - "BaseBarcodeFormatSpecification": "bfs2" - }, - { - "Name": "bfs1-read-rate-first", - "BaseBarcodeFormatSpecification": "bfs1" - }, - { - "Name": "bfs2-read-rate-first", - "BaseBarcodeFormatSpecification": "bfs2" - }, - { - "Name": "bfs1-single-barcode", - "BaseBarcodeFormatSpecification": "bfs1" - }, - { - "Name": "bfs2-single-barcode", - "BaseBarcodeFormatSpecification": "bfs2" - }, - { - "Name": "bfs1-balance", - "BaseBarcodeFormatSpecification": "bfs1" - }, - { - "Name": "bfs2-balance", - "BaseBarcodeFormatSpecification": "bfs2" - }, - { - "Name": "bfs1-dense", - "BaseBarcodeFormatSpecification": "bfs1" - }, - { - "Name": "bfs2-dense", - "BaseBarcodeFormatSpecification": "bfs2" - }, - { - "Name": "bfs1-distant", - "BaseBarcodeFormatSpecification": "bfs1" - }, - { - "Name": "bfs2-distant", - "BaseBarcodeFormatSpecification": "bfs2" - } - ], - "BarcodeReaderTaskSettingOptions": [ - { - "Name": "task-read-barcodes", - "ExpectedBarcodesCount" : 1, - "LocalizationModes": [ - { - "Mode": "LM_SCAN_DIRECTLY", - "ScanDirection": 2 - }, - { - "Mode": "LM_CONNECTED_BLOCKS" - } - ], - "DeblurModes": [ - { - "Mode": "DM_BASED_ON_LOC_BIN" - }, - { - "Mode": "DM_THRESHOLD_BINARIZATION" - } - ], - "BarcodeFormatSpecificationNameArray": [ - "bfs1", - "bfs2" - ], - "SectionImageParameterArray": [ - { - "Section": "ST_REGION_PREDETECTION", - "ImageParameterName": "ip-read-barcodes" - }, - { - "Section": "ST_BARCODE_LOCALIZATION", - "ImageParameterName": "ip-read-barcodes" - }, - { - "Section": "ST_BARCODE_DECODING", - "ImageParameterName": "ip-read-barcodes" - } - ] - }, - { - "Name": "task-read-barcodes-speed-first", - "ExpectedBarcodesCount": 0, - "BarcodeFormatIds" : [ "BF_DEFAULT" ], - "LocalizationModes": [ - { - "Mode": "LM_SCAN_DIRECTLY", - "ScanDirection": 2 - }, - { - "Mode": "LM_CONNECTED_BLOCKS" - } - ], - "DeblurModes": [ - { - "Mode": "DM_BASED_ON_LOC_BIN" - }, - { - "Mode": "DM_THRESHOLD_BINARIZATION" - } - ], - "BarcodeFormatSpecificationNameArray": [ - "bfs1-speed-first", - "bfs2-speed-first" - ], - "SectionImageParameterArray": [ - { - "Section": "ST_REGION_PREDETECTION", - "ImageParameterName": "ip-read-barcodes-speed-first" - }, - { - "Section": "ST_BARCODE_LOCALIZATION", - "ImageParameterName": "ip-read-barcodes-speed-first" - }, - { - "Section": "ST_BARCODE_DECODING", - "ImageParameterName": "ip-read-barcodes-speed-first" - } - ] - }, - { - "Name": "task-read-barcodes-read-rate", - "ExpectedBarcodesCount" : 999, - "LocalizationModes": [ - { - "Mode": "LM_CONNECTED_BLOCKS" - }, - { - "Mode": "LM_LINES" - }, - { - "Mode": "LM_STATISTICS" - } - ], - "DeblurModes": [ - { - "Mode": "DM_BASED_ON_LOC_BIN" - }, - { - "Mode": "DM_THRESHOLD_BINARIZATION" - }, - { - "Mode": "DM_DIRECT_BINARIZATION" - }, - { - "Mode": "DM_SMOOTHING" - } - ], - "BarcodeFormatSpecificationNameArray": [ - "bfs1-read-rate-first", - "bfs2-read-rate-first" - ], - "SectionImageParameterArray": [ - { - "Section": "ST_REGION_PREDETECTION", - "ImageParameterName": "ip-read-barcodes-read-rate" - }, - { - "Section": "ST_BARCODE_LOCALIZATION", - "ImageParameterName": "ip-read-barcodes-read-rate" - }, - { - "Section": "ST_BARCODE_DECODING", - "ImageParameterName": "ip-read-barcodes-read-rate" - } - ] - }, - { - "Name": "task-read-single-barcode", - "ExpectedBarcodesCount": 1, - "LocalizationModes": [ - { - "Mode": "LM_SCAN_DIRECTLY", - "ScanDirection": 2 - }, - { - "Mode": "LM_CONNECTED_BLOCKS" - } - ], - "DeblurModes": [ - { - "Mode": "DM_BASED_ON_LOC_BIN" - }, - { - "Mode": "DM_THRESHOLD_BINARIZATION" - } - ], - "BarcodeFormatSpecificationNameArray": [ - "bfs1-single-barcode", - "bfs2-single-barcode" - ], - "SectionImageParameterArray": [ - { - "Section": "ST_REGION_PREDETECTION", - "ImageParameterName": "ip-read-single-barcode" - }, - { - "Section": "ST_BARCODE_LOCALIZATION", - "ImageParameterName": "ip-read-single-barcode" - }, - { - "Section": "ST_BARCODE_DECODING", - "ImageParameterName": "ip-read-single-barcode" - } - ] - }, - { - "Name": "task-read-barcodes-balance", - "ExpectedBarcodesCount" : 999, - "LocalizationModes": [ - { - "Mode": "LM_CONNECTED_BLOCKS" - }, - { - "Mode": "LM_SCAN_DIRECTLY" - } - ], - "DeblurModes": [ - { - "Mode": "DM_BASED_ON_LOC_BIN" - }, - { - "Mode": "DM_THRESHOLD_BINARIZATION" - }, - { - "Mode": "DM_DIRECT_BINARIZATION" - } - ], - "BarcodeFormatSpecificationNameArray": [ - "bfs1-balance", - "bfs2-balance" - ], - "SectionImageParameterArray": [ - { - "Section": "ST_REGION_PREDETECTION", - "ImageParameterName": "ip-read-barcodes-balance" - }, - { - "Section": "ST_BARCODE_LOCALIZATION", - "ImageParameterName": "ip-read-barcodes-balance" - }, - { - "Section": "ST_BARCODE_DECODING", - "ImageParameterName": "ip-read-barcodes-balance" - } - ] - }, - { - "Name": "task-read-barcodes-dense", - "ExpectedBarcodesCount" : 0, - "LocalizationModes": [ - { - "Mode": "LM_CONNECTED_BLOCKS" - }, - { - "Mode": "LM_LINES" - } - ], - "DeblurModes": [ - { - "Mode": "DM_BASED_ON_LOC_BIN" - }, - { - "Mode": "DM_THRESHOLD_BINARIZATION" - }, - { - "Mode": "DM_DIRECT_BINARIZATION" - }, - { - "Mode": "DM_SMOOTHING" - }, - { - "Mode": "DM_GRAY_EQUALIZATION" - } - ], - "BarcodeFormatSpecificationNameArray": [ - "bfs1-dense", - "bfs2-dense" - ], - "SectionImageParameterArray": [ - { - "Section": "ST_REGION_PREDETECTION", - "ImageParameterName": "ip-read-barcodes-dense" - }, - { - "Section": "ST_BARCODE_LOCALIZATION", - "ImageParameterName": "ip-read-barcodes-dense" - }, - { - "Section": "ST_BARCODE_DECODING", - "ImageParameterName": "ip-read-barcodes-dense" - } - ] - }, - { - "Name": "task-read-barcodes-distant", - "ExpectedBarcodesCount" : 0, - "LocalizationModes": [ - { - "Mode": "LM_CONNECTED_BLOCKS" - }, - { - "Mode": "LM_LINES" - } - ], - "DeblurModes": [ - { - "Mode": "DM_BASED_ON_LOC_BIN" - }, - { - "Mode": "DM_THRESHOLD_BINARIZATION" - }, - { - "Mode": "DM_DIRECT_BINARIZATION" - } - ], - "BarcodeFormatSpecificationNameArray": [ - "bfs1-distant", - "bfs2-distant" - ], - "SectionImageParameterArray": [ - { - "Section": "ST_REGION_PREDETECTION", - "ImageParameterName": "ip-read-barcodes-distant" - }, - { - "Section": "ST_BARCODE_LOCALIZATION", - "ImageParameterName": "ip-read-barcodes-distant" - }, - { - "Section": "ST_BARCODE_DECODING", - "ImageParameterName": "ip-read-barcodes-distant" - } - ] - } - ], - "ImageParameterOptions": [ - { - "Name": "ip-read-barcodes", - "TextDetectionMode": { - "Mode": "TTDM_LINE", - "Direction": "UNKNOWN", - "Sensitivity": 3 - }, - "IfEraseTextZone": 1, - "BinarizationModes": [ - { - "Mode": "BM_LOCAL_BLOCK", - "BlockSizeX": 71, - "BlockSizeY": 71, - "EnableFillBinaryVacancy": 0 - } - ], - "GrayscaleTransformationModes" : [ - { - "Mode": "GTM_ORIGINAL" - } - ] - }, - { - "Name": "ip-read-barcodes-speed-first", - "TextDetectionMode": { - "Mode": "TTDM_LINE", - "Direction": "UNKNOWN", - "Sensitivity": 3 - }, - "IfEraseTextZone": 1, - "BinarizationModes": [ - { - "Mode": "BM_LOCAL_BLOCK", - "BlockSizeX": 71, - "BlockSizeY": 71, - "EnableFillBinaryVacancy": 0 - } - ], - "GrayscaleTransformationModes": [ - { - "Mode": "GTM_ORIGINAL" - } - ] - }, - { - "Name": "ip-read-barcodes-read-rate", - "TextDetectionMode": { - "Mode": "TTDM_LINE", - "Direction": "UNKNOWN", - "Sensitivity": 3 - }, - "IfEraseTextZone": 1, - "BinarizationModes": [ - { - "Mode": "BM_LOCAL_BLOCK", - "BlockSizeX": 0, - "BlockSizeY": 0, - "EnableFillBinaryVacancy": 1 - } - ], - "GrayscaleTransformationModes" : [ - { - "Mode": "GTM_ORIGINAL" - } - ], - "ScaleDownThreshold" : 100000 - }, - { - "Name": "ip-read-single-barcode", - "TextDetectionMode": { - "Mode": "TTDM_LINE", - "Direction": "UNKNOWN", - "Sensitivity": 3 - }, - "IfEraseTextZone": 1, - "BinarizationModes": [ - { - "Mode": "BM_LOCAL_BLOCK", - "BlockSizeX": 71, - "BlockSizeY": 71, - "EnableFillBinaryVacancy": 0 - } - ], - "GrayscaleTransformationModes": [ - { - "Mode": "GTM_ORIGINAL" - } - ] - }, - { - "Name": "ip-read-barcodes-balance", - "TextDetectionMode": { - "Mode": "TTDM_LINE", - "Direction": "UNKNOWN", - "Sensitivity": 3 - }, - "IfEraseTextZone": 1, - "BinarizationModes": [ - { - "Mode": "BM_LOCAL_BLOCK", - "BlockSizeX": 0, - "BlockSizeY": 0, - "EnableFillBinaryVacancy": 1 - } - ], - "GrayscaleTransformationModes" : [ - { - "Mode": "GTM_ORIGINAL" - } - ] - }, - { - "Name": "ip-read-barcodes-dense", - "TextDetectionMode": { - "Mode": "TTDM_LINE", - "Direction": "UNKNOWN", - "Sensitivity": 3 - }, - "IfEraseTextZone": 1, - "BinarizationModes": [ - { - "Mode": "BM_LOCAL_BLOCK", - "BlockSizeX": 0, - "BlockSizeY": 0, - "EnableFillBinaryVacancy": 1 - } - ], - "GrayscaleTransformationModes" : [ - { - "Mode": "GTM_ORIGINAL" - } - ], - "ScaleDownThreshold" : 100000 - }, - { - "Name": "ip-read-barcodes-distant", - "TextDetectionMode": { - "Mode": "TTDM_LINE", - "Direction": "UNKNOWN", - "Sensitivity": 3 - }, - "IfEraseTextZone": 1, - "BinarizationModes": [ - { - "Mode": "BM_LOCAL_BLOCK", - "BlockSizeX": 0, - "BlockSizeY": 0, - "EnableFillBinaryVacancy": 1 - } - ], - "GrayscaleTransformationModes" : [ - { - "Mode": "GTM_ORIGINAL" - } - ], - "ScaleDownThreshold" : 2300 - } - ] -} \ No newline at end of file diff --git a/dist/dbr.bundle.d.ts b/dist/dbr.bundle.d.ts new file mode 100644 index 00000000..1c54afb8 --- /dev/null +++ b/dist/dbr.bundle.d.ts @@ -0,0 +1,12 @@ +import * as dynamsoftCore from 'dynamsoft-core'; +export { dynamsoftCore as Core }; +import * as dynamsoftLicense from 'dynamsoft-license'; +export { dynamsoftLicense as License }; +import * as dynamsoftCaptureVisionRouter from 'dynamsoft-capture-vision-router'; +export { dynamsoftCaptureVisionRouter as CVR }; +import * as dynamsoftCameraEnhancer from 'dynamsoft-camera-enhancer'; +export { dynamsoftCameraEnhancer as DCE }; +import * as dynamsoftBarcodeReader from 'dynamsoft-barcode-reader'; +export { dynamsoftBarcodeReader as DBR }; +import * as dynamsoftUtility from 'dynamsoft-utility'; +export { dynamsoftUtility as Utility }; diff --git a/dist/dbr.bundle.esm.d.ts b/dist/dbr.bundle.esm.d.ts new file mode 100644 index 00000000..bbfbd479 --- /dev/null +++ b/dist/dbr.bundle.esm.d.ts @@ -0,0 +1,6 @@ +export * from 'dynamsoft-core'; +export * from 'dynamsoft-license'; +export * from 'dynamsoft-capture-vision-router'; +export * from 'dynamsoft-camera-enhancer'; +export * from 'dynamsoft-barcode-reader'; +export * from 'dynamsoft-utility'; diff --git a/dist/dbr.bundle.js b/dist/dbr.bundle.js index cbbaa9cb..bbdba9d5 100644 --- a/dist/dbr.bundle.js +++ b/dist/dbr.bundle.js @@ -1,61 +1,11 @@ /*! * Dynamsoft JavaScript Library -* @product Dynamsoft Barcode Reader JS Edition +* @product Dynamsoft Barcode Reader JS Edition Bundle * @website http://www.dynamsoft.com * @copyright Copyright 2024, Dynamsoft Corporation * @author Dynamsoft -* @version 10.2.10 +* @version 10.2.1000 * @fileoverview Dynamsoft JavaScript Library for Barcode Reader * More info on dbr JS: https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/ */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Dynamsoft={})}(this,(function(t){"use strict"; -/*! - * Dynamsoft JavaScript Library - * @product Dynamsoft Core JS Edition - * @website https://www.dynamsoft.com - * @copyright Copyright 2024, Dynamsoft Corporation - * @author Dynamsoft - * @version 3.2.10 - * @fileoverview Dynamsoft JavaScript Library for Core - * More info on Dynamsoft Core JS: https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/core/core-module.html - */function e(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)}function i(t,e,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(t,i):n?n.value=i:e.set(t,i),i}var r,n,s;"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.BOPM_BLOCK=0]="BOPM_BLOCK",t[t.BOPM_UPDATE=1]="BOPM_UPDATE"}(r||(r={})),function(t){t[t.CCUT_AUTO=0]="CCUT_AUTO",t[t.CCUT_FULL_CHANNEL=1]="CCUT_FULL_CHANNEL",t[t.CCUT_Y_CHANNEL_ONLY=2]="CCUT_Y_CHANNEL_ONLY",t[t.CCUT_RGB_R_CHANNEL_ONLY=3]="CCUT_RGB_R_CHANNEL_ONLY",t[t.CCUT_RGB_G_CHANNEL_ONLY=4]="CCUT_RGB_G_CHANNEL_ONLY",t[t.CCUT_RGB_B_CHANNEL_ONLY=5]="CCUT_RGB_B_CHANNEL_ONLY"}(n||(n={})),function(t){t[t.IPF_BINARY=0]="IPF_BINARY",t[t.IPF_BINARYINVERTED=1]="IPF_BINARYINVERTED",t[t.IPF_GRAYSCALED=2]="IPF_GRAYSCALED",t[t.IPF_NV21=3]="IPF_NV21",t[t.IPF_RGB_565=4]="IPF_RGB_565",t[t.IPF_RGB_555=5]="IPF_RGB_555",t[t.IPF_RGB_888=6]="IPF_RGB_888",t[t.IPF_ARGB_8888=7]="IPF_ARGB_8888",t[t.IPF_RGB_161616=8]="IPF_RGB_161616",t[t.IPF_ARGB_16161616=9]="IPF_ARGB_16161616",t[t.IPF_ABGR_8888=10]="IPF_ABGR_8888",t[t.IPF_ABGR_16161616=11]="IPF_ABGR_16161616",t[t.IPF_BGR_888=12]="IPF_BGR_888",t[t.IPF_BINARY_8=13]="IPF_BINARY_8",t[t.IPF_NV12=14]="IPF_NV12",t[t.IPF_BINARY_8_INVERTED=15]="IPF_BINARY_8_INVERTED"}(s||(s={}));const o=t=>Object.prototype.toString.call(t),a=t=>Array.isArray?Array.isArray(t):"[object Array]"===o(t),h=t=>"[object Boolean]"===o(t),l=t=>"number"==typeof t&&!Number.isNaN(t),c=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),u=t=>!(!c(t)||!(t.bytes instanceof Uint8Array)||!l(t.width)||t.width<=0||!l(t.height)||t.height<=0||!l(t.stride)||t.stride<=0||!("format"in t)||"tag"in t&&!f(t.tag)),d=t=>!(!c(t)||!l(t.left)||t.left<0||!l(t.top)||t.top<0||!l(t.right)||t.right<0||!l(t.bottom)||t.bottom<0||t.left>=t.right||t.top>=t.bottom||!h(t.isMeasuredInPercentage)),f=t=>!!c(t)&&!!l(t.imageId)&&"type"in t,g=t=>!(!c(t)||!m(t.startPoint)||!m(t.endPoint)||t.startPoint.x==t.endPoint.x&&t.startPoint.y==t.endPoint.y),m=t=>!!c(t)&&!!l(t.x)&&!!l(t.y),p=t=>!!c(t)&&!!a(t.points)&&0!=t.points.length&&!t.points.some((t=>!m(t))),_=t=>!!c(t)&&!!a(t.points)&&0!=t.points.length&&4==t.points.length&&!t.points.some((t=>!m(t))),v=t=>!(!c(t)||!l(t.x)||!l(t.y)||!l(t.width)||t.width<0||!l(t.height)||t.height<0||"isMeasuredInPercentage"in t&&!h(t.isMeasuredInPercentage));async function y(t,e){return await new Promise(((i,r)=>{let n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.send(),n.onloadend=async()=>{i(n.response)},n.onerror=()=>{r(new Error("Network Error: "+n.statusText))}}))}const w=(t,e)=>{let i=t.split("."),r=e.split(".");for(let t=0;t