Skip to content

Commit 8e68822

Browse files
update to internal commit bbb91c45
1 parent efc4cf5 commit 8e68822

File tree

2 files changed

+65
-65
lines changed

2 files changed

+65
-65
lines changed

programming/javascript/api-reference/barcode-scanner.md

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -165,67 +165,67 @@ interface BarcodeScannerConfig {
165165
**Code Snippet**
166166

167167
```html
168-
<body>
169-
<div id="camera-view-container" style="width: 100%; height: 80vh"></div>
170-
<script>
171-
const barcodeScannerConfig = {
172-
license: "YOUR_LICENSE_KEY_HERE",
173-
// Defines scan behavior:
174-
// - SM_MULTI_UNIQUE: Keeps scanning and continuously collecting unique decoded barcode results.
175-
// - SM_SINGLE: Scans once a result is found.
176-
scanMode: Dynamsoft.EnumScanMode.SM_MULTI_UNIQUE,
177-
// The path to your custom JSON template that defines the scanning process.
178-
templateFilePath:'./DBR-PresetTemplates.json',
179-
// engineResourcePaths typically is only assigned when using a framework like React/Angular/Vue where the resources are not in the same location as the script reference.
180-
engineResourcePaths: {rootDirectory:"https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.0.6000/dist"},
181-
barcodeFormats: [Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE , Dynamsoft.DBR.EnumBarcodeFormat.BF_CODE_128],
182-
showPoweredByDynamsoft: false,
183-
duplicateForgetTime: 3000,
184-
showUploadImageButton: true,
185-
autoStartCapturing: true,
186-
// The container for rendering the scanner and/or result view. Note that ResultView is only valid for SM_MULTI_UNIQUE mode. If not specified, a full-viewport default UI will be created.
187-
container: "#camera-view-container",
188-
scannerViewConfig: {
189-
// The ResultViewConfig goes in here - see ResultViewConfig section
190-
},
191-
resultViewConfig: {
192-
// The ResultViewConfig goes in here - see ResultViewConfig section
193-
},
194-
onUniqueBarcodeScanned: (result) => {
195-
// Do something with the result
196-
},
197-
onInitPrepare: () => {
198-
// Do something before the barcodeScanner initialized
199-
},
200-
onInitReady: (components) => {
201-
// Do something with the foundational components
202-
// Set the scan laser to be visible in cameraView
203-
components.cameraView.setScanLaserVisible(true);
204-
// Set the zoom factor to 3
205-
components.cameraEnhancer.setZoom({
206-
factor: 3
207-
});
208-
// Set the scan region to a rectangle with percentage values by cameraEnhancer
209-
let region = {
210-
"x": 0,
211-
"y": 20,
212-
"width": 100,
213-
"height": 60,
214-
"isMeasuredInPercentage": true
215-
};
216-
components.cameraEnhancer.setScanRegion(region);
217-
},
218-
onCameraOpen: (components) => {
219-
// Do something with the foundational components when the camera is successfully opened for the first time or after each camera switch
220-
},
221-
onCaptureStart: (components) => {
222-
// Do something with the foundational components when the capture process begins
223-
},
168+
<div id="camera-view-container" style="width: 100%; height: 80vh"></div>
169+
<script>
170+
const barcodeScannerConfig = {
171+
license: "YOUR_LICENSE_KEY_HERE",
172+
// Defines scan behavior:
173+
// - SM_MULTI_UNIQUE: Keeps scanning and continuously collecting unique decoded barcode results.
174+
// - SM_SINGLE: Scans once a result is found.
175+
scanMode: Dynamsoft.EnumScanMode.SM_MULTI_UNIQUE,
176+
// The path to your custom JSON template that defines the scanning process.
177+
templateFilePath:'./DBR-PresetTemplates.json',
178+
// engineResourcePaths typically is only assigned when using a framework like React/Angular/Vue where the resources are not in the same location as the script reference.
179+
engineResourcePaths: {rootDirectory:"https://cdn.jsdelivr.net/npm/"},
180+
// path to the UI file
181+
uiPath: "https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.0.6000/dist/ui/barcode-scanner.ui.xml",
182+
barcodeFormats: [Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE , Dynamsoft.DBR.EnumBarcodeFormat.BF_CODE_128],
183+
showPoweredByDynamsoft: false,
184+
duplicateForgetTime: 3000,
185+
showUploadImageButton: true,
186+
autoStartCapturing: true,
187+
// The container for rendering the scanner and/or result view. Note that ResultView is only valid for SM_MULTI_UNIQUE mode. If not specified, a full-viewport default UI will be created.
188+
container: "#camera-view-container",
189+
scannerViewConfig: {
190+
// The ResultViewConfig goes in here - see ResultViewConfig section
191+
},
192+
resultViewConfig: {
193+
// The ResultViewConfig goes in here - see ResultViewConfig section
194+
},
195+
onUniqueBarcodeScanned: (result) => {
196+
// Do something with the result
197+
},
198+
onInitPrepare: () => {
199+
// Do something before the barcodeScanner initialized
200+
},
201+
onInitReady: (components) => {
202+
// Do something with the foundational components
203+
// Set the scan laser to be visible in cameraView
204+
components.cameraView.setScanLaserVisible(true);
205+
// Set the zoom factor to 3
206+
components.cameraEnhancer.setZoom({
207+
factor: 3
208+
});
209+
// Set the scan region to a rectangle with percentage values by cameraEnhancer
210+
let region = {
211+
"x": 0,
212+
"y": 20,
213+
"width": 100,
214+
"height": 60,
215+
"isMeasuredInPercentage": true
224216
};
225-
// Initialize the BarcodeScanner with the above BarcodeScannerConfig object
226-
const barcodeScanner = new Dynamsoft.BarcodeScanner(barcodeScannerConfig);
227-
</script>
228-
</body>
217+
components.cameraEnhancer.setScanRegion(region);
218+
},
219+
onCameraOpen: (components) => {
220+
// Do something with the foundational components when the camera is successfully opened for the first time or after each camera switch
221+
},
222+
onCaptureStart: (components) => {
223+
// Do something with the foundational components when the capture process begins
224+
},
225+
};
226+
// Initialize the BarcodeScanner with the above BarcodeScannerConfig object
227+
const barcodeScanner = new Dynamsoft.BarcodeScanner(barcodeScannerConfig);
228+
</script>
229229
```
230230

231231
### ScannerViewConfig

programming/javascript/user-guide/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The complete code of the "Hello World" example is shown below
115115
cvRouter.setInput(cameraEnhancer);
116116
117117
const resultsContainer = document.querySelector("#results");
118-
cvRouter.addResultReceiver({ onDecodedBarcodesReceived: (result) => {
118+
cvRouter.addResultReceiver({ onCapturedResultReceived: (result) => {
119119
if (result.barcodeResultItems?.length) {
120120
resultsContainer.textContent = '';
121121
for (let item of result.barcodeResultItems) {
@@ -397,13 +397,13 @@ cvRouter.setInput(cameraEnhancer);
397397
398398
### Step 4: Register a result receiver
399399
400-
Once the image processing is complete, the results are sent to all the registered `CapturedResultReceiver` objects. Each `CapturedResultReceiver` object may encompass one or multiple callback functions associated with various result types. This time we use `onDecodedBarcodesReceived`:
400+
Once the image processing is complete, the results are sent to all the registered `CapturedResultReceiver` objects. Each `CapturedResultReceiver` object may encompass one or multiple callback functions associated with various result types. This time we use `onCapturedResultReceived`:
401401
<!--In our particular case, our focus is on identifying barcodes within the images, so it's sufficient to define the callback function `onDecodedBarcodesReceived`:-->
402402
403403
```javascript
404404
const resultsContainer = document.querySelector("#results");
405405
const resultReceiver = new Dynamsoft.CVR.CapturedResultReceiver();
406-
resultReceiver.onDecodedBarcodesReceived = (result) => {
406+
resultReceiver.onCapturedResultReceived = (result) => {
407407
if (result.barcodeResultItems?.length) {
408408
resultsContainer.textContent = '';
409409
for (let item of result.barcodeResultItems) {
@@ -419,7 +419,7 @@ You can also write code like this. It is the same.
419419
420420
```javascript
421421
const resultsContainer = document.querySelector("#results");
422-
cvRouter.addResultReceiver({ onDecodedBarcodesReceived: (result) => {
422+
cvRouter.addResultReceiver({ onCapturedResultReceived: (result) => {
423423
if (result.barcodeResultItems?.length) {
424424
resultsContainer.textContent = '';
425425
for (let item of result.barcodeResultItems) {
@@ -505,7 +505,7 @@ Please be aware that it is necessary to update the `CapturedResultReceiver` obje
505505
506506
```javascript
507507
const EnumCRIT = Dynamsoft.Core.EnumCapturedResultItemType;
508-
resultReceiver.onDecodedBarcodesReceived = (result) => {
508+
resultReceiver.onCapturedResultReceived = (result) => {
509509
if (result.barcodeResultItems?.length) {
510510
// Use a filter to get the image on which barcodes are found.
511511
let image = result.items.filter(

0 commit comments

Comments
 (0)