You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fill A Form - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/fill-a-form-with-barcode-reading.html)
79
-
- Show result information on the video - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/show-result-texts-on-the-video.html)
- Fill A Form - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/fill-a-form-with-barcode-reading.html)\|[Run](https://demo.dynamsoft.com/Samples/DBR/JS/use-case/fill-a-form-with-barcode-reading.html?ver=10.4.20&utm_source=guide)
78
+
- Show result information on the video - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/show-result-texts-on-the-video.html)\|[Run](https://demo.dynamsoft.com/Samples/DBR/JS/use-case/show-result-texts-on-the-video.html?ver=10.4.20&utm_source=guide)
80
79
- Debug Camera and Collect Video Frame - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/others/debug)
81
80
82
81
You can also:
@@ -116,8 +115,8 @@ The complete code of the "Hello World" example is shown below
@@ -204,34 +203,18 @@ When a barcode is decoded, you will see the result text show up under the video
204
203
205
204
Alternatively, you can test locally by copying and pasting the code shown above into a local file (e.g. "hello-world.html") and opening it in your browser.
206
205
207
-
*Note*:
208
-
209
-
If you open the web page as `file:///` or `http://` , the camera may not work correctly because the [MediaDevices:getUserMedia()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) method only works in secure contexts (HTTPS), in some or all supporting browsers.
210
-
211
-
To make sure your web application can access the camera, please configure your web server to support HTTPS. The following links may help.
If the test doesn't go as expected, you can [contact us](https://www.dynamsoft.com/company/contact/?ver=10.4.20&utm_source=guide&product=dbr&package=js).
206
+
> *Secure Contexts*:
207
+
>
208
+
> If you open the web page as `http://` , our SDK may not work correctly because the [MediaDevices: getUserMedia()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) and other methods only work in [secure contexts](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) (HTTPS, `localhost`, `127.0.0.1`, `file://`), in some or all supporting browsers.
209
+
>
210
+
> Regarding configuring https on your server, these guides for [nginx](https://nginx.org/en/docs/http/configuring_https_servers.html) / [IIS](https://aboutssl.org/how-to-create-a-self-signed-certificate-in-iis/) / [tomcat](https://dzone.com/articles/setting-ssl-tomcat-5-minutes) / [nodejs](https://nodejs.org/docs/v0.4.1/api/tls.html) might help.
211
+
>
212
+
> If the test doesn't go as expected, you can [contact us](https://www.dynamsoft.com/company/contact/?ver=10.4.20&utm_source=guide&product=dbr&package=js).
219
213
220
214
## Building your own page
221
215
222
216
### Include the SDK
223
217
224
-
To utilize the SDK, the initial step involves including the corresponding resource files:
225
-
226
-
* `core.js` encompasses common classes, interfaces, and enumerations shared across all Dynamsoft SDKs.
227
-
* `license.js` introduces the `LicenseManager` class, which manages the licensing for all Dynamsoft SDKs.
228
-
* `utility.js` encompasses auxiliary classes shared among all Dynamsoft SDKs.
229
-
* `dbr.js` defines interfaces and enumerations tailored to the barcode reader module.
230
-
* `cvr.js` introduces the `CaptureVisionRouter` class, which governs the entire image processing workflow.
231
-
* `dce.js` comprises classes that offer camera support and basic user interface functionalities.
232
-
233
-
To simplify things, starting from version 10.0.21, we introduced `dbr.bundle.js`, which combines all six of the above files. In the following chapters, we will use `dbr.bundle.js`.
234
-
235
218
#### Use a public CDN
236
219
237
220
The simplest way to include the SDK is to use either the [jsDelivr](https://jsdelivr.com/) or [UNPKG](https://unpkg.com/) CDN. The "hello world" example above uses **jsDelivr**.
@@ -256,7 +239,7 @@ The simplest way to include the SDK is to use either the [jsDelivr](https://jsde
256
239
257
240
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.
258
241
259
-
- In frameworks like Reactand Vue, you may want to add the package as a dependency.
242
+
- In frameworks like React, Vue and Angular, you may want to add the package as a dependency.
260
243
261
244
```sh
262
245
npm i dynamsoft-barcode-reader-bundle@10.4.2002 -E
@@ -270,19 +253,13 @@ The simplest way to include the SDK is to use either the [jsDelivr](https://jsde
270
253
271
254
Besides using the public CDN, you can also download the SDK and host its files on your own server or a commercial CDN before including it in your application.
272
255
273
-
There are two options for downloading the SDK, and the usage for each is slightly different
The resources are located at the path `node_modules/<pkg>`, without `@<version>`. You need to copy "dynamsoft-xxx" packages elsewhere and add `@<version>`. `<version>` can be get from `package.json` of each package.
299
272
300
-
Since the version tags (`@<version>`) are missing, you need to [specify the engineResourcePaths](#specify-the-location-of-the-engine-files-optional) so that the SDK can find the resources correctly.
273
+
You can typically include SDK like this:
301
274
302
-
> To avoid confusion, we suggest renaming "node_modules" or moving "dynamsoft-" packages elsewhere for self-hosting, as "node_modules" is reserved for Node.js dependencies.
2. Manually define the mimetype on your server. You can refer to the guides for [apache](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Apache_Configuration_htaccess#media_types_and_character_encodings) / [IIS](https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/mimemap) / [nginx](https://www.nginx.com/resources/wiki/start/topics/examples/full/#mime-types).
312
284
313
285
* To work properly, the SDK requires a few engine files, which are relatively large and may take quite a few seconds to download. We recommend that you set a longer cache time for these engine files, to maximize the performance of your web application.
314
286
315
-
```cmd
287
+
```
316
288
Cache-Control: max-age=31536000
317
289
```
318
290
@@ -336,14 +308,20 @@ As previously stated, the key "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" serves
336
308
337
309
#### Specify the location of the "engine" files (optional)
338
310
339
-
This is usually only required with frameworks like Angular or React, etc. where the referenced JavaScript files such as `cvr.js`, `dbr.js` are compiled into another file.
311
+
This is usually only required with frameworks like Angular, React or Vue.
340
312
341
-
The purpose is to tell the SDK where to find the engine files (\*.worker.js, \*.wasm.js and \*.wasm, etc.). The API is called `Dynamsoft.Core.CoreModule.engineResourcePaths`:
313
+
The purpose is to tell the SDK where to find the engine files (\*.worker.js, \*.wasm.js and \*.wasm, etc.).
342
314
343
-
```javascript
344
-
//The following code uses the jsDelivr CDN as an example, feel free to change it to your own location of these files
315
+
```ts
316
+
// in framework
317
+
import { CoreModule } from "dynamsoft-barcode-reader-bundle";
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. In our particular case, our focus is on identifying barcodes within the images, so it's sufficient to define the callback function `onDecodedBarcodesReceived`:
390
+
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`:
391
+
<!--In our particular case, our focus is on identifying barcodes within the images, so it's sufficient to define the callback function `onDecodedBarcodesReceived`:-->
The UI is part of the auxiliary SDK "Dynamsoft Camera Enhancer", read more on how to [customize the UI](https://www.dynamsoft.com/barcode-reader/docs/core/programming/features/ui-customization-js.html?lang=js).
687
683
688
684
## API Documentation
689
685
690
686
You can check out the detailed documentation about the APIs of the SDK at
<!-- Compatibility is basically not an issue. Pls remove to another place
690
+
693
691
## System Requirements
694
692
695
693
DBR requires the following features to work:
@@ -728,6 +726,8 @@ The following table is a list of supported browsers based on the above requireme
728
726
729
727
Apart from the browsers, the operating systems may impose some limitations of their own that could restrict the use of the SDK. Browser compatibility ultimately depends on whether the browser on that particular operating system supports the features listed above.
730
728
729
+
-->
730
+
731
731
## How to Upgrade
732
732
733
733
If you want to upgrade the SDK from an old version to a newer one, please see [how to upgrade](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/upgrade-guide/index.html?ver=10.4.2002&utm_source=guide).
0 commit comments