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
Copy file name to clipboardExpand all lines: programming/javascript/user-guide/foundational-api.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ In this guide, you will learn step by step on how to integrate the DBR-JS SDK in
33
33
34
34
<spanstyle="font-size:20px">Table of Contents</span>
35
35
36
-
-[Barcode Reader for Your Website - User Guide](#barcode-reader-for-your-website---user-guide)
36
+
-[Barcode Reader for Your Website - Foundational API Guide](#barcode-reader-for-your-website---foundational-api-guide)
37
37
-[Hello World - Simplest Implementation](#hello-world---simplest-implementation)
38
38
-[Understand the code](#understand-the-code)
39
39
-[About the code](#about-the-code)
@@ -272,9 +272,6 @@ Besides using the public CDN, you can also download the SDK and host its files o
272
272
273
273
```sh
274
274
npm i dynamsoft-barcode-reader-bundle@11.2.4000 -E
275
-
# Compared with using CDN, you need to set up more resources.
276
-
npm i dynamsoft-capture-vision-std@1.4.21 -E
277
-
npm i dynamsoft-image-processing@2.4.31 -E
278
275
```
279
276
280
277
The resources are located at the path `node_modules/<pkg>`, without `@<version>`. You must copy "dynamsoft-xxx" packages elsewhere and add `@<version>`. The `<version>` can be obtained from `package.json` of each package. Another thing to do is to [specify the engineResourcePaths](#2-optional-specify-the-location-of-the-engine-files) so that the SDK can correctly locate the resources.
> We recommend not renaming any module files within the `./dist` directory, as this may cause the rootDirectory configuration to not work properly. In such cases, you would need to define resource paths for each module individually.
92
+
> We recommend not renaming any module files within the `./dist` directory, as this may cause the rootDirectory configuration to not work properly. You can copy “dynamsoft-barcode-reader-bundle” package elsewhere and add `@<version>`. The `<version>` can be obtained from package.json
93
93
> In our case the packages are used only as static resources, we recommend moving the `./dist` to a dedicated folder forstatic resourcesin your project to facilitate self-hosting.
94
94
95
95
Next, we will demonstrate how to introduce `dynamsoft.config.ts` into a specific component. Don't skip the [Component for Reading Image](#component-for-reading-image) section even if you only need video barcode decoding.
# Dynamsoft Barcode Reader JavaScript - ZIP Package Guide
2
2
3
3
Welcome! This package contains all resource files related to **Dynamsoft Barcode Reader JavaScript SDK**, and sample projects demonstrating how to use it.
4
4
5
5
---
6
6
7
+
## System Requirements
8
+
9
+
### Secure Context (HTTPS Deployment)
10
+
11
+
When deploying your application / website for production, make sure to serve it via a secure HTTPS connection. This is required for two reasons:
12
+
13
+
- Access to the camera video stream is only granted in a security context. Most browsers impose this restriction.
14
+
- Dynamsoft License requires a secure context to work.
15
+
16
+
> Some browsers like Chrome may grant access for `http://127.0.0.1` and `http://localhost` or even for pages opened directly from the local disk (`file:///...`). This can be helpful for temporary development and test.
17
+
18
+
### Browser Compatibility
19
+
20
+
The following table is a list of supported browsers based on the above requirements:
21
+
22
+
| Browser Name | Version |
23
+
| :----------: | :--------------: |
24
+
| Chrome | v78+<sup>1</sup> |
25
+
| Firefox | v68+<sup>1</sup> |
26
+
| Edge | v79+ |
27
+
| Safari | v14.5+ |
28
+
29
+
<sup>1</sup> Devices running iOS need to be on iOS 14.5+ for camera video streaming to work in Chrome, Firefox or other apps using webviews.
30
+
31
+
Apart from the browsers, the operating systems may impose some limitations of their own that could restrict the use of the SDK.
32
+
33
+
---
34
+
35
+
## License
36
+
37
+
Dynamsoft provides a complimentary trial license for the SDK. When you download the SDK package from the Dynamsoft website, after creating a Dynamsoft account, the following license will have a 30-day free trial:
38
+
39
+
`DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9`
40
+
41
+
>[!IMPORTANT]
42
+
> Once your trial license expires, the SDK will throw an error and cease to function. You can visit the Dynamsoft Customer Portal (https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=installer&package=js) to view your trial license details. Additionally, it's possible to extend the trial period via the customer portal, allowing for a total trial duration of 60 days.
43
+
44
+
---
45
+
46
+
## Quick Start
47
+
48
+
Double-click `samples/hello-world.html` to instantly see a fully functional web application that scans a single barcode using your device's camera! You can also try `samples/read-an-image.html` to decode barcodes from an image file.
49
+
50
+
>[!NOTE]
51
+
> These samples load the SDK from a CDN so they can be opened directly as local files without a web server. An internet connection is required. To serve everything from the local `dist/` folder, see [Deploying to Your Server](#deploying-to-your-server).
52
+
53
+
---
54
+
7
55
## How to Run the Samples
8
56
9
-
### 1. Unzip the Sample Files
57
+
### 1. Unzip the Package
10
58
11
-
After unzipping, you should see two folders: `dist`, which contains all the Barcode Reader JavaScript SDK resources, and `samples`, which includes subfolders for the individual sample projects.
59
+
After unzipping, you should see the following structure:
-`samples/` — Sample projects, including standalone examples (`hello-world.html`, `read-an-image.html`), framework integrations, and scenario demos
63
+
-`LICENSE` — Dynamsoft license terms
64
+
-`LEGAL.txt` — Third-party license notices
12
65
13
66
### 2. Open the Samples in a Browser
14
67
15
-
To explore the full set of available samples, open the `index.html` file in your browser.
68
+
To explore the full set of available samples, open the `samples/index.html` file in your browser.
16
69
17
-
>[!IMPORTANT]
18
-
> Some browsers block local file access for security reasons. To avoid these restrictions, run the samples through a local web server.
70
+
>[!NOTE]
71
+
> The included samples load from a CDN by default. To use the local `dist/` folder instead, a web server is required (the browser blocks local file fetches over `file:///`):
72
+
> -**Standalone & scenario samples**: Switch to the commented-out `<script>` tag that points to the local `dist/` folder. No other changes are needed — the SDK infers resource paths from the script tag location.
73
+
> -**Framework samples**: These use npm imports and explicitly set `engineResourcePaths` to a CDN URL. Update `engineResourcePaths.rootDirectory` to point to the local `dist/` folder.
19
74
20
-
Here are a couple of easy ways to start one:
75
+
Here are a couple of easy ways to start a local web server:
21
76
22
77
- Using Five Server VSCode extension
23
78
24
-
If you are using VS Code, simply install the [Five Server extension](https://marketplace.visualstudio.com/items?itemName=yandeu.five-server), open the `Samples` folder in the editor, and click "Go Live" in the bottom right corner of the editor. This will serve the sample project at http://127.0.0.1:5500/index.html.
79
+
If you are using VS Code, simply install the [Five Server extension](https://marketplace.visualstudio.com/items?itemName=yandeu.five-server), open the `samples` folder in the editor, and click "Go Live" in the bottom right corner of the editor. This will serve the sample project at http://127.0.0.1:5500/index.html.
25
80
26
81
- Using Node.js and `serve`
27
82
@@ -32,13 +87,7 @@ Here are a couple of easy ways to start one:
32
87
npx serve . -l 8000
33
88
```
34
89
35
-
Once the server is running, open your browser and navigate to:
36
-
37
-
```bash
38
-
http://localhost:8000
39
-
```
40
-
41
-
You'll see the `index.html` page, which links to all sample pages.
90
+
Once the server is running, open your browser and navigate to `http://localhost:8000`. You'll see the `index.html` page, which links to all sample pages.
42
91
43
92
>[!TIP]
44
93
> Don't want to set up a local server? You can view the latest version of our samples hosted on the Dynamsoft server here:
@@ -48,8 +97,69 @@ Here are a couple of easy ways to start one:
48
97
49
98
## Sample Folders
50
99
51
-
- `frameworks/` - This directory contains framework-specific examples demonstrating how to integrate the Dynamsoft Barcode Reader (JavaScript edition) into common web and hybrid frameworks. Each framework folder contains one or more runnable sub-examples (for example, scan-using-foundational-api and/or scan-using-rtu-api) showing practical integration patterns.
52
-
- `scenarios/` - This directory contains focused scenario samples that show common real-world uses of the Dynamsoft Barcode Reader (JavaScript edition).
100
+
The package includes two main sample directories:
101
+
102
+
- **`frameworks/`** - Framework-specific examples showing how to integrate the Dynamsoft Barcode Reader into common web and hybrid frameworks. Each framework folder contains one or more runnable sub-examples (such as `scan-using-foundational-api` and/or `scan-using-rtu-api`). Included frameworks: Angular, Blazor, Capacitor, Electron, ES6, Native TypeScript, Next.js, Nuxt, PWA, React, RequireJS, Svelte, Vue, and WebView.
103
+
104
+
- **`scenarios/`** - Focused scenario samples covering common real-world uses of the Dynamsoft Barcode Reader, including workflow patterns (Cart Builder, Scan and Search, Batch Inventory, etc.), barcode-type-specific scanning (QR Code, DataMatrix, 1D Retail/Industrial, etc.), and data parsing (Driver's License, VIN, GS1-AI).
105
+
106
+
---
107
+
108
+
## Choosing an API
109
+
110
+
The SDK provides two approaches for integrating barcode scanning capabilities:
111
+
112
+
### Ready-To-Use (RTU) API — BarcodeScanner
113
+
114
+
The RTU API offers the quickest path to a working barcode scanner (**Recommended for most users**):
115
+
116
+
- **One-line integration** – Launch a full scanner with a single API call
117
+
- **Built-in UI** – Pre-designed viewfinder and scan region highlighting
118
+
- **Simple configuration** – Customize behavior through intuitive config objects
119
+
120
+
### Foundational APIs
121
+
122
+
If you are looking for a fully customizable barcode decoding library with complete control over the scanning process and UI, you are welcome to use the Foundational APIs.
123
+
124
+
---
125
+
126
+
## Deploying to Your Server
127
+
128
+
When you're ready to deploy your application to production, copy the `dist` folder to your server and reference it in your project:
129
+
130
+
1. Copy the `dist` folder to your server
131
+
2. Include the script and configure the SDK to load all resources locally:
132
+
133
+
```html
134
+
<!DOCTYPE html>
135
+
<html>
136
+
<head>
137
+
<title>Barcode Scanner</title>
138
+
<!-- Adjust the path based on where you host the dist folder -->
> When loading the SDK via a `<script>` tag, `engineResourcePaths` is optional — the SDK infers resource paths from the script tag location. It is required when using npm imports (e.g., in framework projects).
161
+
162
+
---
53
163
54
164
## Documentation
55
165
@@ -58,18 +168,14 @@ For API reference and more advanced usage, visit:
58
168
- [Barcode Scanner API Docs](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/barcode-scanner.html)
59
169
- [Foundational API Docs](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/index.html)
60
170
61
-
---
171
+
For more information about the resource files in the `dist/` directory, please refer to:
62
172
63
-
## License
64
-
65
-
Dynamsoft provides a complimentary trial license for the SDK. When you download the SDK package from the Dynamsoft website, after creating a Dynamsoft account, the following license will have a 30-day free trial:
173
+
- [What’s in the dist folder of dynamsoft-barcode-reader-bundle](https://www.dynamsoft.com/faq/barcode-reader/web/capabilities/what-is-in-the-dist-folder-of-dbr.html)
66
174
67
-
`DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9`
68
-
69
-
You can visit the Dynamsoft Customer Portal (https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=installer&package=js) to view your trial license details. Additionally, it's possible to extend the trial period via the customer portal, allowing for a total trial duration of 60 days.
175
+
---
70
176
71
-
## Contact
177
+
## Support
72
178
73
-
If you run into any issues, please feel free to contact us at `support@dynamsoft.com`.
179
+
If you run into any issues, please feel free to contact us at support@dynamsoft.com.
0 commit comments