Skip to content

Commit 31cfb3e

Browse files
committed
feat: update and add MDS self hosting instructions
1 parent 2beb6e1 commit 31cfb3e

File tree

4 files changed

+105
-2
lines changed

4 files changed

+105
-2
lines changed

guide/angular.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,43 @@ Open `http://localhost:4200/` to view the sample app.
7676
> [!NOTE]
7777
> Secure context requires HTTPS to provide camera access, but Angular CLI serves over HTTP by default. For mobile testing, you may need to configure HTTPS or use a reverse proxy.
7878
79+
## Self-Host Resources
80+
81+
You can self host the resources for the Hello World by following a few simple steps. Refer to the [plain JavaScript self-hosting guide]({{ site.guide }}index.html#quick-start) for details.
82+
83+
### Set File Paths
84+
85+
First we set MDS to look resource paths where we will place the resources later:
86+
87+
```typescript
88+
const documentScanner = new Dynamsoft.DocumentScanner({
89+
license: "YOUR_LICENSE_KEY_HERE",
90+
scannerViewConfig: {
91+
cameraEnhancerUIPath: "dist/libs/dynamsoft-document-scanner/dist/document-scanner.ui.html",
92+
},
93+
engineResourcePaths: {
94+
rootDirectory: "dist/libs/"
95+
},
96+
});
97+
```
98+
99+
### Move Resources
100+
101+
Now, add a script (`get-libs`) to automatically move the resources to their destination when building the project (`build`) in `samples/framework/angular/package.json`:
102+
103+
```json
104+
"scripts": {
105+
"ng": "ng",
106+
"start": "ng serve --ssl",
107+
"build": "ng build && npm run get-libs",
108+
"get-libs": "npm install --no-save dynamsoft-capture-vision-data dynamsoft-capture-vision-bundle && npx mkdirp /dist/libs && npx cpx 'node_modules/dynamsoft-*/**/*' dist/libs/ --dereference",
109+
"watch": "ng build --watch --configuration development",
110+
"test": "ng test"
111+
},
112+
```
113+
114+
When building, **swap the build script** from `ng build` to `npm run build`. Continue using `ng serve` to serve the application.
115+
79116
## Customization
80117

81118
Please check the official [documentation]({{ site.guide }}index.html).

guide/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ The library uses [`engineResourcePaths`]({{ site.api }}index.html#engineresource
192192
const documentScanner = new Dynamsoft.DocumentScanner({
193193
license: "YOUR_LICENSE_KEY_HERE",
194194
scannerViewConfig: {
195-
cameraEnhancerUIPath: "./dist/document-scanner.ui.html", // Use the local file
195+
cameraEnhancerUIPath: "dist/document-scanner.ui.html", // Use the local file
196196
},
197197
engineResourcePaths: {
198198
rootDirectory: "dist/libs/"
@@ -216,7 +216,7 @@ Update the `scripts` section in `package.json` to automatically copy resources t
216216
"scripts": {
217217
"serve": "node dev-server/index.js",
218218
"build": "rollup -c && npm run get-libs",
219-
"get-libs": "npm install --no-save dynamsoft-capture-vision-data && npx mkdirp dist/libs && npx cpx 'node_modules/dynamsoft-*/**/*' dist/libs/ --dereference",
219+
"get-libs": "npm install --no-save dynamsoft-capture-vision-data dynamsoft-capture-vision-bundle && npx mkdirp /dist/libs && npx cpx 'node_modules/dynamsoft-*/**/*' dist/libs/ --dereference,
220220
"build:production": "rollup -c --environment BUILD:production"
221221
},
222222
```

guide/react.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,39 @@ npm start
6666

6767
Then open https://localhost:3000/ to view the sample app.
6868

69+
## Self-Host Resources
70+
71+
You can self host the resources for the Hello World by following a few simple steps. Refer to the [plain JavaScript self-hosting guide]({{ site.guide }}index.html#quick-start) for details.
72+
73+
### Set File Paths
74+
75+
First we set MDS to look resource paths where we will place the resources later:
76+
77+
```typescript
78+
const documentScanner = new Dynamsoft.DocumentScanner({
79+
license: "YOUR_LICENSE_KEY_HERE",
80+
scannerViewConfig: {
81+
cameraEnhancerUIPath: "dist/libs/dynamsoft-document-scanner/dist/document-scanner.ui.html",
82+
},
83+
engineResourcePaths: {
84+
rootDirectory: "dist/libs/"
85+
},
86+
});
87+
```
88+
89+
### Move Resources
90+
91+
Now, add a script (`get-libs`) to automatically move the resources to their destination when building the project (`build`) in `samples/framework/react-hooks/package.json`:
92+
93+
```json
94+
"scripts": {
95+
"dev": "vite",
96+
"build": "tsc && vite build && npm run get-libs",
97+
"get-libs": "npm install --no-save dynamsoft-capture-vision-data dynamsoft-capture-vision-bundle && npx mkdirp /dist/libs && npx cpx 'node_modules/dynamsoft-*/**/*' dist/libs/ --dereference",
98+
"preview": "vite preview"
99+
},
100+
```
101+
69102
## Customization
70103

71104
Please check the official [documentation]({{ site.guide }}index.html).

guide/vue.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,39 @@ npm run serve
6666

6767
Then open http://localhost:8080/ to view the sample app.
6868

69+
## Self-Host Resources
70+
71+
You can self host the resources for the Hello World by following a few simple steps. Refer to the [plain JavaScript self-hosting guide]({{ site.guide }}index.html#quick-start) for details.
72+
73+
### Set File Paths
74+
75+
First we set MDS to look resource paths where we will place the resources later:
76+
77+
```typescript
78+
const documentScanner = new Dynamsoft.DocumentScanner({
79+
license: "YOUR_LICENSE_KEY_HERE",
80+
scannerViewConfig: {
81+
cameraEnhancerUIPath: "dist/libs/dynamsoft-document-scanner/dist/document-scanner.ui.html",
82+
},
83+
engineResourcePaths: {
84+
rootDirectory: "dist/libs/"
85+
},
86+
});
87+
```
88+
89+
### Move Resources
90+
91+
Now, add a script (`get-libs`) to automatically move the resources to their destination when building the project (`build`) in `samples/framework/vue/package.json`:
92+
93+
```json
94+
"scripts": {
95+
"dev": "vite",
96+
"build": "tsc && vite build && npm run get-libs",
97+
"get-libs": "npm install --no-save dynamsoft-capture-vision-data dynamsoft-capture-vision-bundle && npx mkdirp /dist/libs && npx cpx 'node_modules/dynamsoft-*/**/*' dist/libs/ --dereference",
98+
"preview": "vite preview"
99+
},
100+
```
101+
69102
## Customization
70103

71104
Please check the official [documentation]({{ site.guide }}index.html).

0 commit comments

Comments
 (0)