Skip to content

Commit 3295ced

Browse files
8.0.0
1 parent 10fc3e7 commit 3295ced

File tree

2 files changed

+79
-320
lines changed

2 files changed

+79
-320
lines changed

README.md

Lines changed: 39 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ cdn
4242
<script>
4343
let scanner = null;
4444
(async()=>{
45-
scanner = await Dynamsoft.BarcodeScanner.createInstance();
45+
scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
4646
scanner.onFrameRead = results => {console.log(results);};
4747
scanner.onUnduplicatedRead = (txt, result) => {alert(txt);};
4848
await scanner.show();
@@ -62,12 +62,12 @@ cdn
6262
### Node
6363
6464
```js
65-
let Dynamsoft = require('dynamsoft-node-barcode');
65+
let DBR = require('dynamsoft-node-barcode');
6666
// Please visit https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx to get a trial license
67-
Dynamsoft.BarcodeReader.productKeys = 'PRODUCT-KEYS';
67+
DBR.BarcodeReader.productKeys = 'PRODUCT-KEYS';
6868
6969
(async()=>{
70-
let reader = await Dynamsoft.BarcodeReader.createInstance();
70+
let reader = await DBR.BarcodeReader.createInstance();
7171
for(let result of await reader.decode('https://demo.dynamsoft.com/dbr/img/AllSupportedBarcodeTypes.png')){
7272
console.log(result.barcodeText);
7373
}
@@ -177,7 +177,7 @@ Dynamsoft.BarcodeReader.productKeys = 'PRODUCT-KEYS';
177177

178178
<sup>2</sup> The compact edition downloads and compiles faster, which makes it more suitable for the scenario where a customer only needs to scan a barcode once. In comparison, scenarios where an employee needs to scan lots of barcodes continuously or where uncommon barcodes or advanced features are required, use the full edition by simply setting the following before you call `loadWasm` or `CreateInstance`.
179179

180-
`Dynamsoft.BarcodeReader._bUseFullFeature = true;`
180+
`Dynamsoft.DBR.BarcodeReader._bUseFullFeature = true;`
181181

182182
## Live Demo
183183

@@ -213,7 +213,7 @@ Create an HTML file with the following content. Deploy this to your web server a
213213
<script>
214214
let scanner = null;
215215
(async()=>{
216-
scanner = await Dynamsoft.BarcodeScanner.createInstance();
216+
scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
217217
scanner.onFrameRead = results => {console.log(results);};
218218
scanner.onUnduplicatedRead = (txt, result) => {alert(txt);};
219219
await scanner.show();
@@ -222,7 +222,7 @@ Create an HTML file with the following content. Deploy this to your web server a
222222
</body>
223223
</html>
224224
```
225-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/pL4e7yrd/)
225+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/3gtaycm0/)
226226

227227
### Step Two: Tackle a few issues.
228228

@@ -285,7 +285,7 @@ Now, take a look at the sample code. You can find that there is nothing but two
285285
<script>
286286
let scanner = null;
287287
(async()=>{
288-
scanner = await Dynamsoft.BarcodeScanner.createInstance();
288+
scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
289289
scanner.onFrameRead = results => {console.log(results);};
290290
scanner.onUnduplicatedRead = (txt, result) => {alert(txt);};
291291
await scanner.show();
@@ -307,24 +307,24 @@ In the following sections, you'll find more detailed information on how the libr
307307

308308
The library is based on the `WebAssembly` standard; therefore, **on first use**, it needs some time to download and compile the `wasm` files. After the first use, the browser may cache the file so that the next time no 'downloading' is required.
309309

310-
`Dynamsoft.BarcodeReader.loadWasm` is the API to start the initialization.
310+
`Dynamsoft.DBR.BarcodeReader.loadWasm` is the API to start the initialization.
311311

312312
```js
313313
try{
314-
await Dynamsoft.BarcodeReader.loadWasm();
314+
await Dynamsoft.DBR.BarcodeReader.loadWasm();
315315
}catch(ex){
316316
console.error(ex);
317317
}
318318
```
319319

320-
That said, as shown in the sample above, you don't necessarily need to call the above API because other APIs like `Dynamsoft.BarcodeReader.createInstance` and `Dynamsoft.BarcodeScanner.createInstance` will call `loadWasm` themselves.
320+
That said, as shown in the sample above, you don't necessarily need to call the above API because other APIs like `Dynamsoft.DBR.BarcodeReader.createInstance` and `Dynamsoft.DBR.BarcodeScanner.createInstance` will call `loadWasm` themselves.
321321

322322
```js
323323
let reader = null;
324324
let scanner = null;
325325
try{
326-
reader = await Dynamsoft.BarcodeReader.createInstance();
327-
scanner = await Dynamsoft.BarcodeScanner.createInstance();
326+
reader = await Dynamsoft.DBR.BarcodeReader.createInstance();
327+
scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
328328
}catch(ex){
329329
console.error(ex);
330330
}
@@ -355,12 +355,12 @@ When creating an instance of the `BarcodeScanner` object, there are several conf
355355
// set which camera and what resolution to use
356356
await scanner.updateVideoSettings({ video: { width: 1280, height: 720, facingMode: "environment" } });
357357

358-
// use one of three built-in RuntimeSetting templates, 'speed' is recommended for decoding from a video stream
359-
await scanner.updateRuntimeSettings("speed");
358+
// use one of three built-in RuntimeSetting templates, 'single' is recommended for decoding from a video stream
359+
await scanner.updateRuntimeSettings("single");
360360

361361
// make changes to the template. The code snippet below demonstrates how to specify which symbologies are enabled
362362
let runtimeSettings = await scanner.getRuntimeSettings();
363-
runtimeSettings.barcodeFormatIds = Dynamsoft.EnumBarcodeFormat.BF_ONED | Dynamsoft.EnumBarcodeFormat.BF_QR_CODE;
363+
runtimeSettings.barcodeFormatIds = Dynamsoft.DBR.EnumBarcodeFormat.BF_ONED | Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE;
364364
await scanner.updateRuntimeSettings(runtimeSettings);
365365

366366
// set up the scanner behavior
@@ -372,13 +372,13 @@ scanSettings.intervalTime = 300;
372372
await scanner.updateScanSettings(scanSettings);
373373
```
374374

375-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/yfkcajxz/)
375+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/pa7g85wh/)
376376

377377
As you can see in the code, there are three categories of configurations.
378378

379379
* `get/updateVideoSettings`: Configures the data source, i.e., the video stream. These settings include which camera to use, the resolution, etc.. Learn more [here](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Syntax).
380-
* `get/updateRuntimeSettings`: Configures the decode engine. Find a full list of these settings and their corresponding descriptions [here](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html).
381-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/f24h8c1m/)
380+
* `get/updateRuntimeSettings`: Configures the decode engine. Find a full list of these settings and their corresponding descriptions [here](https://www.dynamsoft.com/barcode-reader/programming/c-cplusplus/struct/PublicRuntimeSettings.html?ver=latest).
381+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/h3o4kfau/)
382382

383383
e.g.
384384
```js
@@ -396,13 +396,13 @@ As you can see in the code, there are three categories of configurations.
396396
```js
397397
let settings = await barcodeScanner.getRuntimeSettings();
398398
settings.localizationModes = [
399-
Dynamsoft.EnumLocalizationMode.LM_CONNECTED_BLOCKS,
400-
Dynamsoft.EnumLocalizationMode.LM_SCAN_DIRECTLY,
401-
Dynamsoft.EnumLocalizationMode.LM_LINES, 0, 0, 0, 0, 0];
399+
Dynamsoft.DBR.EnumLocalizationMode.LM_CONNECTED_BLOCKS,
400+
Dynamsoft.DBR.EnumLocalizationMode.LM_SCAN_DIRECTLY,
401+
Dynamsoft.DBR.EnumLocalizationMode.LM_LINES, 0, 0, 0, 0, 0];
402402
settings.deblurLevel = 2;
403403
await barcodeScanner.updateRuntimeSettings(settings);
404404
```
405-
* `get/updateScanSettings`: Configures the behavior of the scanner which includes `duplicateForgetTime`, `intervalTime` and `filter`, etc.
405+
* `get/updateScanSettings`: Configures the behavior of the scanner which includes `duplicateForgetTime`, `intervalTime`, etc.
406406

407407
### Customizing the UI
408408

@@ -411,7 +411,7 @@ While the library provides a built-in `BarcodeScanner` which has its own UI, fee
411411
The default scanner UI is defined in the file `dist/dbr.scanner.html`. There are 3 ways to customize it:
412412

413413
1. Modify the file `dist/dbr.scanner.html` directly (only possible when you deploy these files yourself instead of using the CDN).
414-
2. Copy the file `dist/dbr.scanner.html`, modify it and specify the new file as the default UI by its URL `Dynamsoft.BarcodeScanner.defaultUIElementURL = url`. Note that you must set `defaultUIElementURL` before you call `createInstance`.
414+
2. Copy the file `dist/dbr.scanner.html`, modify it and specify the new file as the default UI by its URL `Dynamsoft.DBR.BarcodeScanner.defaultUIElementURL = url`. Note that you must set `defaultUIElementURL` before you call `createInstance`.
415415
3. Build the UI into your own web page and call `scanner.setUIElement(HTMLElement)` to specify that element.
416416

417417
The following introduces the 3rd way. Check out the following code on how it's done.
@@ -428,7 +428,7 @@ The following introduces the 3rd way. Check out the following code on how it's d
428428
<script>
429429
let scanner = null;
430430
(async()=>{
431-
scanner = await Dynamsoft.BarcodeScanner.createInstance();
431+
scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
432432
await scanner.setUIElement(document.getElementById('div-video-container'));
433433
scanner.onFrameRead = results => {console.log(results);};
434434
scanner.onUnduplicatedRead = (txt, result) => {alert(txt);};
@@ -438,7 +438,7 @@ The following introduces the 3rd way. Check out the following code on how it's d
438438
</body>
439439
</html>
440440
```
441-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/2jzeq1r6/)
441+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/21chb5pd/)
442442

443443
The code has set the element `div-video-container` as the UI and inside it there is a video element for showing the video stream.
444444

@@ -455,15 +455,15 @@ Next, you can add the camera list and resolution list.
455455
```html
456456
<select class="dbrScanner-sel-camera"></select>
457457
```
458-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/nbj75vxu/)
458+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/4uwhngms/)
459459

460460
```html
461461
<select class="dbrScanner-sel-resolution"></select>
462462
```
463463

464464
> 8 default resolutions will automatically show up.
465465
466-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/25v08paf/)
466+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/ygx0mvL7/)
467467

468468
Too many resolutions may be overwhelming for end users. Check out the following code on how to offer your own resolution options.
469469

@@ -480,87 +480,15 @@ Too many resolutions may be overwhelming for end users. Check out the following
480480
>
481481
> **Solution**: To take care of this issue, you can add an option with the class name `dbrScanner-opt-gotResolution` (as shown above) which the library will then use to show the actual resolution being used.
482482
483-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/tnfjks4q/)
484-
485-
<!--
486-
#### Customizing Further
487-
488-
You may not want to use elements with the default class names to show the camera list or resolution list. In this case, you need to populate the two lists yourself.
489-
490-
For camera list, you can use the API `getAllCameras()` to get all available cameras and then populate them on the page.
491-
492-
```HTML
493-
<select id="custom-camera-list"></select>
494-
```
495-
496-
```javascript
497-
let cameraList = document.getElementById("custom-camera-list");
498-
let allCameras = await scanner.getAllCameras();
499-
let currentCamera = await scanner.getCurrentCamera();
500-
cameraList.options.length = 0;
501-
for (let camera of allCameras) {
502-
cameraList.options.add(new Option(camera.label, camera.deviceId));
503-
if (camera.deviceId == currentCamera.deviceId){
504-
cameraList.selectedIndex = i;
505-
}
506-
}
507-
```
508-
509-
Switch to the selected camera.
510-
511-
```js
512-
cameraList.onchange = async() => {
513-
await scanner.setCurrentCamera(cameraList.options[cameraList.selectedIndex].value);
514-
};
515-
```
516-
517-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/2L9ta7mj/)
518-
519-
If you have more than one camera and would like to use a certain one of them. Try out the code below.
520-
521-
```js
522-
await barcodeScanner.show();
523-
let allCameras = await barcodeScanner.getAllCameras();
524-
for (let camera of allCameras) {
525-
if (camera.label == 'Your-Camera-Name') {
526-
await barcodeScanner.setCurrentCamera(camera.deviceId);
527-
break;
528-
}
529-
}
530-
```
531-
532-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/kLvgt3w2/)
533-
534-
For resolution list, you can show your preferred resolutions and use the API `setResolution` to set the selected option.
535-
536-
```html
537-
<select id="custom-camera-resolution">
538-
<option data-width="1920" data-height="1080">1920 x 1080</option>
539-
<option data-width="1280" data-height="720">1280 x 720</option>
540-
<option data-width="640" data-height="480">640 x 480</option>
541-
</select>
542-
```
543-
544-
```javascript
545-
let resolutionList = document.getElementById("custom-camera-resolution");
546-
resolutionList.onchange = async() => {
547-
await barcodeScanner.setResolution(
548-
resolutionList.options[resolutionList.selectedIndex].getAttribute("data-width"),
549-
resolutionList.options[resolutionList.selectedIndex].getAttribute("data-height")
550-
);
551-
};
552-
```
553-
554-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/djhvno5b/)
555-
-->
483+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/9r8bucof/)
556484

557485
## Advanced Usage
558486

559487
### **Print out log for better debugging**
560488
Include the following in your code to print internal logs in the console.
561489

562490
```javascript
563-
Dynamsoft.BarcodeReader._onLog = console.log;
491+
Dynamsoft.DBR.BarcodeReader._onLog = console.log;
564492
```
565493

566494
### Show found barcodes
@@ -576,7 +504,7 @@ Try the following code to show found barcodes in `input` elements on the page
576504
let iptIndex = 0;
577505
let scanner = null;
578506
(async()=>{
579-
scanner = await Dynamsoft.BarcodeScanner.createInstance();
507+
scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
580508
await scanner.setUIElement(document.getElementById('div-video-container'));
581509
scanner.onFrameRead = results => {console.log(results);};
582510
scanner.onUnduplicatedRead = (txt)=>{
@@ -590,7 +518,7 @@ let scanner = null;
590518
await scanner.show();
591519
})();
592520
```
593-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/tz9ngm2a/)
521+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/9d6uxe15/)
594522

595523
### Read a specific area/region
596524

@@ -610,7 +538,7 @@ settings.region.regionRight = 75;
610538
settings.region.regionBottom = 75;
611539
await scanner.updateRuntimeSettings(settings);
612540
```
613-
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/taykq592/)
541+
[Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/ju0c64ow/)
614542

615543
## Self-hosted | Offline | Intranet Deployment
616544

@@ -649,7 +577,7 @@ Locate the following files and place them in the same directory on your server.
649577

650578
If the resource files like the `wasm` files are not placed in the same directory as the file `dbr.js`. Then you will need to specify the path with the API `engineResourcePath`. Note that it must be set before `loadWasm` or `createInstance` is called.
651579
```js
652-
Dynamsoft.BarcodeReader.engineResourcePath = "url/to/the/dir/";
580+
Dynamsoft.DBR.BarcodeReader.engineResourcePath = "url/to/the/dir/";
653581
```
654582

655583
## Known Issues
@@ -658,74 +586,19 @@ Dynamsoft.BarcodeReader.engineResourcePath = "url/to/the/dir/";
658586

659587
## Changelog
660588

661-
https://www.dynamsoft.com/Products/Dynamic-Barcode-Reader-News.aspx#javascript
662-
663-
## How to Upgrade
664-
665-
#### From version `7.2.2-v2` to `7.3.0-v0`
666-
667-
* If you are using a CDN, be sure to change the version number in the URL like this
668-
669-
```javascript
670-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
671-
```
672-
673-
* If you have deployed the library files on your own server, you'll need to replace the old files with the new version. Download the latest version [here](https://www.dynamsoft.com/Downloads/Dynamic-Barcode-Reader-Download.aspx).
674-
675-
#### From versions prior to`7.2.2-v2` to `7.3.0-v0`
676-
677-
Dynamsoft made several changes in the version `7.2.2-v2`; therefore it may take a bit more effort to upgrade the library from an older version to the version `7.2.2-v2` or a later version including the latest `7.3.0-v0` (as of January 2020). Apart from changing the code to include the correct version of the library, you'll also need to make changes to your code related to the APIs of the library. Check out [this post](https://blog.dynamsoft.com/insights/dynamsoft-barcode-reader-sdk-for-javascript-upgrade-from-v7-1-3-to-v7-2-2/) for more information. If you need further assistance with the upgrade, please feel free to contact [Dynamsoft Support](#contact-us).
589+
https://www.dynamsoft.com/barcode-reader/programming/javascript/release-notes/
678590

591+
## How to Upgrade from version `7.x.x` to `8.x.x`
679592

593+
https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/upgrade.html?ver=latest#from-v7x-to-v8x
680594

681595
## API Documentation
682596

683-
<!--for github: link need use online-->
684-
685-
[Online Document](https://www.dynamsoft.com/help/Barcode-Reader-wasm/)
686-
687-
<!-- Decoding Images: [BarcodeReader](https://www.dynamsoft.com/help/Barcode-Reader-wasm/classes/barcodereader.html)
688-
689-
Decoding Video Stream: [BarcodeScanner](https://www.dynamsoft.com/help/Barcode-Reader-wasm/classes/barcodescanner.html) -->
597+
[Online Document](https://www.dynamsoft.com/barcode-reader/programming/javascript/?ver=latest)
690598

691599
## License Activation
692600

693-
It takes several steps to activate a purchased license, the following steps assume you have already acquired a commercial license from Dynamsoft. If you haven't done so yet, you can purchase a license [here](https://www.dynamsoft.com/Secure/Barcode-Reader-BuyIt.aspx).
694-
695-
* **Step One** : Log in the [Customer Portal](https://www.dynamsoft.com/customer/license/fullLicense) with your Dynamsoft account
696-
697-
If you don't have an Dynamsoft account, sign up [here](https://www.dynamsoft.com/CustomerPortal/Account/Registration.aspx). Be sure to use the same email that was registered for the purchase.
698-
699-
* **Step Two** : Find the License
700-
701-
Once logged in, click **Full License** under **License** on the left menu bar and you should be able to see your purchased key on the right pane.
702-
703-
* **Step Three** : Activate the License
704-
705-
Under **Status**, click the button **Activate** to go to the Activation page, click **Activate** again and confirm the activation.
706-
707-
* **Step Four** : Set a Domain
708-
709-
This step is optional but recommended. By setting a domain to your key, you can protect it against usage abuse. To do this, go back to **Full License**, find your License and click **Details**. On the Details page, click **Order Detail** to get to the order details page where you can see a **Set Domain** button. Click it, specify a domain and submit.
710-
711-
> A few examples of the domain
712-
>
713-
> www.dynamsoft.com
714-
>
715-
> demo.dynamsoft.com
716-
>
717-
> \*.dynamsoft.com
718-
719-
* **Step Five** : Use the License
720-
721-
You may have noticed that in all the samples above, we have the following line of code
722-
723-
```html
724-
<!-- Please visit https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx to get a trial license. -->
725-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script>
726-
```
727-
728-
To use your activated key, you simply need to replace `PRODUCT-KEYS` with it.
601+
https://www.dynamsoft.com/barcode-reader/license-activation/set-full-license.html?ver=latest
729602

730603
## License Agreement
731604

0 commit comments

Comments
 (0)