diff --git a/faq/general-troubleshooting-steps.md b/faq/general-troubleshooting-steps.md index 0febb314..34fc9f48 100644 --- a/faq/general-troubleshooting-steps.md +++ b/faq/general-troubleshooting-steps.md @@ -25,8 +25,9 @@ permalink: /faq/general-troubleshooting-steps.html - Linux, `/opt/dynamsoft/DynamsoftService/log` 2. Set the log level - 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. - 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` + - 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. + - 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. + - 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` ```javascript function Dynamsoft_OnReady() { DWObject = Dynamsoft.DWT.GetWebTwain("dwtcontrolContainer"); diff --git a/indepth/development/mobile-web-capture.md b/indepth/development/mobile-web-capture.md new file mode 100644 index 00000000..e9bca4b5 --- /dev/null +++ b/indepth/development/mobile-web-capture.md @@ -0,0 +1,98 @@ +--- +layout: default-layout +needAutoGenerateSidebar: true +title: How to enable mobile capture +keywords: Dynamic Web TWAIN, Documentation, Mobile Web Capture +breadcrumbText: Mobile Web Capture +description: Dynamic Web TWAIN SDK Documentation Mobile Web Capture Page +--- + +> [!WARNING] +> 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. + +# How to Enable Mobile Web Capture + +You can follow the steps below to use Dynamic Web TWAIN SDK to enable image capture from mobile cameras in a web page. + + + +## Start a Web application + +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. + +## Include the library + +Embed the scripts of the library, among which `dynamsoft.webtwain.addon.camera.js` is the add-on module for mobile web capture. + +``` html + + + +``` + +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. + +``` html +
+``` + +## Add code for mobile web capture + +The below code shows how to scan a document from scanners on desktop and invoke the camera module for mobile capture. + +``` javascript +function AcquireImage() { + if (DWObject) { + if (Dynamsoft.Lib.env.bMobile) { + var showVideoConfigs = { + scannerViewer:{ + autoDetect:{ + enableAutoDetect: true + } + }, + filterViewer: { + exitDocumentScanAfterSave: true + } + }; + + if(!DWObject.UseLocalService) { + // invoke the camera module for mobile capture + DWObject.Addon.Camera.scanDocument(showVideoConfigs).then( + function(){ + console.log("OK"); + }, + function(error){ + console.log(error.message); + }); + } + } + else { + DWObject.SelectSource( + function() { + DWObject.OpenSource(); + DWObject.AcquireImage(); + }, + function() { + console.log("SelectSource failed!"); + }); + } + } +} +``` + +## See the mobile capture page in action + +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. + +## Try mobile capture demo + +Here is a working mobile capture online demo which you can test. + +- [Try mobile capture online demo](https://demo.dynamsoft.com/web-twain/mobile-online-camera-scanner/) +- [Download mobile capture sample code](https://www.dynamsoft.com/web-twain/sample-downloads/?demoSampleId=663) + +## Additional notes: + +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. + +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`. diff --git a/indepth/features/input.md b/indepth/features/input.md index 3b2a418c..14ff378f 100644 --- a/indepth/features/input.md +++ b/indepth/features/input.md @@ -22,6 +22,25 @@ A local scanner refers to a scanner that is plugged in the same desktop via USB > 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. +### Scan From an eSCL Scanner +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. +> See [this blog post](https://www.dynamsoft.com/blog/announcement/dynamic-web-twain-escl-scanner/) for more information about eSCL. + +- To scan from an eSCL Scanner to PC, the Dynamsoft Service must be installed on the client PC +- 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). + +The following code shows how one way to acquire the image via the eSCL protocol. +``` javascript +//Get the list of available eSCL scanners +let esclDeviceList=await DWObject.GetDevicesAsync(Dynamsoft.DWT.EnumDWT_DeviceType.ESCLSCANNER) + +//Select the desired scanner from the list +await DWObject.SelectDeviceAsync(esclDeviceList[0]) + +//Acquire image (with configuration) +await DWObject.AcquireImageAsync({Resolution:100,IfShowUI:false}) +``` + ## Capture from cameras ### Use [DirectShow Cameras]({{site.getstarted}}hardware.html#directshow-cameras) diff --git a/info/api/WebTwain_Viewer.md b/info/api/WebTwain_Viewer.md index 732e672f..ddf14b52 100644 --- a/info/api/WebTwain_Viewer.md +++ b/info/api/WebTwain_Viewer.md @@ -62,20 +62,20 @@ bind(element: HTMLDivElement | HTMLElement) : boolean; **Example** ```javascript -var DWObject, template; +var DWObject; Dynamsoft.DWT.CreateDWTObjectEx( { - WebTwainId: "a", + WebTwainId: "dwtControl" }, function (obj) { DWObject = obj; - template = DWObject.Viewer.getElementById("dwtcontrolContainer_temp3"); - DWObject.Viewer.width=500; - DWObject.Viewer.height=600; + DWObject.Viewer.bind("dwtcontrolContainer"); + DWObject.Viewer.width=600; + DWObject.Viewer.height=800; DWObject.Viewer.show(); }, - function (errorCode, errorString) { - console.log(errorString); + function (err) { + console.log(err); }); ```