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
-[Modify the Build Script](#modify-the-build-script)
21
+
-[Point to Resources](#point-to-resources)
22
22
-[Build the Project](#build-the-project)
23
+
-[Host `node` Packages](#host-node-packages)
23
24
-[Serve the Project Locally](#serve-the-project-locally)
24
25
-[Serve over HTTPS](#serve-over-https)
25
26
-[Set MIME Type](#set-mime-type)
@@ -180,7 +181,11 @@ Alternatively, you can use other methods like `IIS` or `Apache` to serve the pro
180
181
181
182
### Self-Host Resources
182
183
183
-
By default, the MDSlibrary (whether pre-compiled or self-compiled) fetches resource files (Dynamsoft `node` dependencies and an HTMLUI template) from CDNs. Self-hosting library resources gives you full control over hosting your application. Rather than using CDNs to serve these resources, you can instead host these resources on your own servers to deliver to your users directly when they use your application. You can also use this option to host MDS fully offline by pointing to local resources.
184
+
By default, the MDSlibrary (whether pre-compiled or self-compiled) fetches resource files (Dynamsoft `node` dependencies and an HTMLUI template) from CDNs. Self-hosting library resources gives you full control over hosting your application. Rather than using CDNs to serve these resources, you can instead host these resources on your own servers to deliver to your users directly when they use your application. You can also use this option to host MDS fully offline by pointing to local resources. Here are the resources to self-host:
185
+
186
+
1.`document-scanner.ui.xml`- the UI template for the `DocumentScannerView`/viewfinder.
187
+
2.`dynamsoft-capture-vision-bundle`- the `node`packagefor the Dynamsoft Capture Vision (DCV) engine resources.
188
+
3.`dynamsoft-capture-vision-data`- the `node`packageforDCV engine configuration templates.
184
189
185
190
#### Download Resources
186
191
@@ -199,12 +204,29 @@ First, download a copy of the resources:
199
204
4. In the terminal, navigate to the project root directory and run the following to install project dependencies:
> We install `dynamsoft-capture-vision-data` as MDS does not use it as a build dependency.
213
+
214
+
#### Modify the Build Script
215
+
216
+
Add a script by updating the `scripts` property in`package.json` that automatically copies the two `node` dependencies to the output `dist` directory during the build process. We will configure MDS to request the resources here.
The library uses [`engineResourcePaths`](https://www.dynamsoft.com/mobile-document-scanner/docs/web/api/index.html#engineresourcepaths) to locate required Dynamsoft `node` dependencies by pointing to the location of the resources on your web server. The library also uses `scannerViewConfig.cameraEnhancerUIPath` similarly to set the path for the HTML UI template of the `ScannerView`. Later steps will place both the `node` dependencies and the HTML template in the local `dist` directory. Therefore, set `engineResourcePaths` in the MDS constructor to point to the local `dist` directory (along with setting your license key, and all other configurations):
229
+
The library uses [`engineResourcePaths`](https://www.dynamsoft.com/mobile-document-scanner/docs/web/api/index.html#engineresourcepaths) to locate required Dynamsoft `node` dependencies by pointing to the location of the resources on your web server. The library also uses `scannerViewConfig.cameraEnhancerUIPath` similarly to set the path for the HTML UI template of the `ScannerView`.Therefore, set `engineResourcePaths` in the MDS constructor to point to the local `dist` directory, where the resources are located (along with setting your license key, and all other configurations):
208
230
209
231
```javascript
210
232
const documentScanner = new Dynamsoft.DocumentScanner({
@@ -213,12 +235,8 @@ const documentScanner = new Dynamsoft.DocumentScanner({
213
235
cameraEnhancerUIPath: "./dist/document-scanner.ui.xml", // Use the local file
0 commit comments