Skip to content

Commit f52c348

Browse files
authored
Merge pull request #720 from dynamsoft-docs/preview
Push preview changes to Master
2 parents d4526ea + 1f8f960 commit f52c348

File tree

4 files changed

+127
-9
lines changed

4 files changed

+127
-9
lines changed

faq/general-troubleshooting-steps.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ permalink: /faq/general-troubleshooting-steps.html
2525
- Linux, `/opt/dynamsoft/DynamsoftService/log`
2626

2727
2. Set the log level
28-
Option A - Single client machine troubleshooting - go to the application with Dynamic Web TWAIN integrated, press F12 to open the development tools, switch to "console" tab and enter the command "DWObject.LogLevel = 1" to enable the debugger mode.
29-
Option B - For all client machines (application wide) - set [ `LogLevel` ]({{site.info}}api/WebTwain_Util.html#loglevel) to 1 in your code. This property should be set as soon as the `WebTwain` instance is created. For example, in the event `Dynamsoft_OnReady`
28+
- Option A - (Only recommended for v18.0+) For only one client machine, add the line `LogLevel=14` to `DSConfiguration.ini` on that specific machine. To find the `DSConfiguration.ini` file, please return to the previous directory from the log directory.
29+
- Option B - Single client machine troubleshooting - go to the application with Dynamic Web TWAIN integrated, press F12 to open the development tools, switch to "console" tab and enter the command `DWObject.LogLevel = 1` to enable the debugger mode.
30+
- Option C - For all client machines (application wide) - set [ `LogLevel` ]({{site.info}}api/WebTwain_Util.html#loglevel) to 1 in your code. This property should be set as soon as the `WebTwain` instance is created. For example, in the event `Dynamsoft_OnReady`
3031
```javascript
3132
function Dynamsoft_OnReady() {
3233
DWObject = Dynamsoft.DWT.GetWebTwain("dwtcontrolContainer");
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
layout: default-layout
3+
needAutoGenerateSidebar: true
4+
title: How to enable mobile capture
5+
keywords: Dynamic Web TWAIN, Documentation, Mobile Web Capture
6+
breadcrumbText: Mobile Web Capture
7+
description: Dynamic Web TWAIN SDK Documentation Mobile Web Capture Page
8+
---
9+
10+
> [!WARNING]
11+
> Mobile Web Capture has been removed from Dynamic Web TWAIN as of Release 18.2. If you still require Mobile Web Capture, you must use the Plus edition of Dynamic Web TWAIN v18.1. Please contact [support@dynamsoft.com](mailto:support@dynamsoft.com) for further details.
12+
13+
# How to Enable Mobile Web Capture
14+
15+
You can follow the steps below to use Dynamic Web TWAIN SDK to enable image capture from mobile cameras in a web page.
16+
17+
<!--- Firstly, please [download and install Dynamic Web TWAIN](https://www.dynamsoft.com/web-twain/downloads) if you haven't done so. --->
18+
19+
## Start a Web application
20+
21+
Create a `mobile-capture.html` and copy the `Resources` folder of Dynamic Web TWAIN, which can be found under the installation folder, to the same location.
22+
23+
## Include the library
24+
25+
Embed the scripts of the library, among which `dynamsoft.webtwain.addon.camera.js` is the add-on module for mobile web capture.
26+
27+
``` html
28+
<script src="Resources/dynamsoft.webtwain.initiate.js"></script>
29+
<script src="Resources/dynamsoft.webtwain.config.js"></script>
30+
<script src="Resources/addon/dynamsoft.webtwain.addon.camera.js"></script>
31+
```
32+
33+
Add an `div` element on the page for the library. `dwtcontrolContainer` is the default ID for the div. You can change it in the file `dynamsoft.webtwain.config.js` if necessary.
34+
35+
``` html
36+
<div id="dwtcontrolContainer"></div>
37+
```
38+
39+
## Add code for mobile web capture
40+
41+
The below code shows how to scan a document from scanners on desktop and invoke the camera module for mobile capture.
42+
43+
``` javascript
44+
function AcquireImage() {
45+
if (DWObject) {
46+
if (Dynamsoft.Lib.env.bMobile) {
47+
var showVideoConfigs = {
48+
scannerViewer:{
49+
autoDetect:{
50+
enableAutoDetect: true
51+
}
52+
},
53+
filterViewer: {
54+
exitDocumentScanAfterSave: true
55+
}
56+
};
57+
58+
if(!DWObject.UseLocalService) {
59+
// invoke the camera module for mobile capture
60+
DWObject.Addon.Camera.scanDocument(showVideoConfigs).then(
61+
function(){
62+
console.log("OK");
63+
},
64+
function(error){
65+
console.log(error.message);
66+
});
67+
}
68+
}
69+
else {
70+
DWObject.SelectSource(
71+
function() {
72+
DWObject.OpenSource();
73+
DWObject.AcquireImage();
74+
},
75+
function() {
76+
console.log("SelectSource failed!");
77+
});
78+
}
79+
}
80+
}
81+
```
82+
83+
## See the mobile capture page in action
84+
85+
To try out the mobile web capture, please first deploy the web application as an HTTPS site so that it will get proper authentication to access the mobile cameras.
86+
87+
## Try mobile capture demo
88+
89+
Here is a working mobile capture online demo which you can test.
90+
91+
- [Try mobile capture online demo](https://demo.dynamsoft.com/web-twain/mobile-online-camera-scanner/)
92+
- [Download mobile capture sample code](https://www.dynamsoft.com/web-twain/sample-downloads/?demoSampleId=663)
93+
94+
## Additional notes:
95+
96+
1. By default, the size of the viewer is 270 in width and 350 in height, so it'll appear to be too small. Check out [how to customize the viewer]({{site.indepth}}features/viewer.html#customize-the-viewer) for more information.
97+
98+
2. Important: Not all mobile browsers allow the use of cameras. Check out [browsers on mobile devices]({{site.getstarted}}platform.html#browsers-on-mobile-devices) for more information. If you are using an unsupported browser (for example, Chrome on iOS), you may receive the error `The current browser has not implemented the MediaDevices interface`.

indepth/features/input.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ A local scanner refers to a scanner that is plugged in the same desktop via USB
2222

2323
> As far as `Dynamic Web TWAIN` is concerned, a network scanner is just like a local scanner because its driver has taken care of the network connection behind the scene.
2424
25+
### Scan From an eSCL Scanner
26+
Many modern scanners and multi-functional printers (MFPs) support the eSCL protocol. The protocol is a vendor-neutral network protocol that allows driverless scanning via ethernet, wireless and USB-connected devices. eSCL-compatible scanners advertise themselves via mDNS so that we can find them easily. mDNS is a zero-configuration service. It is implemented by Apple Bonjour and the open-source Avahi software packages.
27+
> See [this blog post](https://www.dynamsoft.com/blog/announcement/dynamic-web-twain-escl-scanner/) for more information about eSCL.
28+
29+
- To scan from an eSCL Scanner to PC, the Dynamsoft Service must be installed on the client PC
30+
- To scan from an eSCL Scanner to Android, you must install the Android Service on the client device from the [Play Store](https://play.google.com/store/apps/details?id=com.dynamsoft.mobilescan).
31+
32+
The following code shows how one way to acquire the image via the eSCL protocol.
33+
``` javascript
34+
//Get the list of available eSCL scanners
35+
let esclDeviceList=await DWObject.GetDevicesAsync(Dynamsoft.DWT.EnumDWT_DeviceType.ESCLSCANNER)
36+
37+
//Select the desired scanner from the list
38+
await DWObject.SelectDeviceAsync(esclDeviceList[0])
39+
40+
//Acquire image (with configuration)
41+
await DWObject.AcquireImageAsync({Resolution:100,IfShowUI:false})
42+
```
43+
2544
## Capture from cameras
2645

2746
### Use [DirectShow Cameras]({{site.getstarted}}hardware.html#directshow-cameras)

info/api/WebTwain_Viewer.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ bind(element: HTMLDivElement | HTMLElement) : boolean;
6262
**Example**
6363

6464
```javascript
65-
var DWObject, template;
65+
var DWObject;
6666
Dynamsoft.DWT.CreateDWTObjectEx(
6767
{
68-
WebTwainId: "a",
68+
WebTwainId: "dwtControl"
6969
},
7070
function (obj) {
7171
DWObject = obj;
72-
template = DWObject.Viewer.getElementById("dwtcontrolContainer_temp3");
73-
DWObject.Viewer.width=500;
74-
DWObject.Viewer.height=600;
72+
DWObject.Viewer.bind("dwtcontrolContainer");
73+
DWObject.Viewer.width=600;
74+
DWObject.Viewer.height=800;
7575
DWObject.Viewer.show();
7676
},
77-
function (errorCode, errorString) {
78-
console.log(errorString);
77+
function (err) {
78+
console.log(err);
7979
});
8080
```
8181

0 commit comments

Comments
 (0)