Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repositoryUrl: https://github.com/Dynamsoft/web-twain-docs/blob/master
firstLevelUrl: /web-twain/docs
repository: Dynamsoft/web-twain-docs
docFullPath: https://www.dynamsoft.com/web-twain/docs
productUrl: https://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx
productName: Dynamic Web TWAIN
Expand Down
22 changes: 21 additions & 1 deletion _includes/sidelist-indepth/troubleshooting.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,27 @@
<ul>
{%- if page.url contains '/indepth/troubleshooting/' -%}
<li><a href="{{ site.indepth }}troubleshooting/debug.html" class="otherLinkColour">How to Debug</a></li>
<li><a href="{{ site.indepth }}troubleshooting/Handle-Errors.html" class="otherLinkColour">Handle Errors</a></li>
<li><a href="{{ site.indepth }}troubleshooting/license-errors/index.html" class="otherLinkColour">License Errors</a>
<ul>
<li><a href="{{ site.indepth }}troubleshooting/license-errors/invalid-key.html" class="otherLinkColour">Invalid License</a></li>
<li><a href="{{ site.indepth }}troubleshooting/license-errors/Domain-does-not-match.html" class="otherLinkColour">Domain Doesn't Match</a></li>
<li><a href="{{ site.indepth }}troubleshooting/license-errors/key-expired.html" class="otherLinkColour">License Expired</a></li>
<li><a href="{{ site.indepth }}troubleshooting/license-errors/OCR-lic-exceeded.html" class="otherLinkColour">OCR License Exceeded</a></li>
</ul>
</li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/index.html" class="otherLinkColour">Common Errors</a>
<ul>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/general-failure.html" class="otherLinkColour">General failure</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/connection-couldn't-be-established.html" class="otherLinkColour">Connection Couldn't Be Established</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/HTTP-process-error.html" class="otherLinkColour">HTTP Process Error</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/HTTP-request-error.html" class="otherLinkColour">HTTP Request Error</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/JPEG-compression.html" class="otherLinkColour">JPEG Compression</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/XMLHttpRequest-cannot-load.html" class="otherLinkColour">XMLHttpRequest Cannot Load</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/source-connected-to-maximum.html" class="otherLinkColour">Source Connected To Maximum</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/sequence-error.html" class="otherLinkColour">Sequence Error</a></li>
<li><a href="{{ site.indepth }}troubleshooting/common-errors/dwt-md5-is-not-allowed.html" class="otherLinkColour">dwt-md5 Is Not Allowed</a></li>
</ul>
</li>
{%- endif -%}
</ul>
</li>
78 changes: 78 additions & 0 deletions indepth/troubleshooting/common-errors/HTTP-process-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting HTTP Process Error
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors, HTTP Process Error
breadcrumbText: HTTP Process Error
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors HTTP Process Error Page
---


# Handling Errors

## HTTP process error

* Symptom

When you upload images using any of the HTTPUploadThroughPost*** methods, you may receive the error.

* Cause
+ The write permission is not granted to the specified directory on the web server.
+ The action page is incorrect or returns something from the web server.
+ The port specified for uploading is the incorrect one.
+ The size of the images you are trying to upload is beyond the maximum allowed size set by the server.

* Solution
+ Make sure the users who are uploading have permission to write images to the specified directory on the web server. (For example, give "Write" permission to the Authenticated Users.)
+ Check the response string returned from the HTTP server to figure out the cause of the process error. You can get this string by using the [HTTPPostResponseString]({{site.info}}api/WebTwain_IO.html#httppostresponsestring) property.
+ Set the port to the correct one using [HTTPPort]({{site.info}}api/WebTwain_IO.html#httpport). We recommend you get the Port and Server values this way:

``` javascript
var strHTTPServer = location.hostname;
DWObject.HTTPPort = location.port == "" ? 80 : location.port;
```
+ If you have set [IfSSL]({{site.info}}api/WebTwain_IO.html#ifssl) to true, you must set a secure port for the HTTPPort property. For example,

``` javascript
DWObject.IfSSL = true;
DWObject.HTTPPort = 443;
```
> For example: If the URL for the scan page is "http://localhost:3253/....", you should set the port to 3253.

* Checking the server-side configuration is also useful in this scenario
+ Please reset the maximum transferable data size. If you are using `ASP.NET` , you can change the value in the following line in the `Web.Config` file.

``` xml
<httpRuntime maxRequestLength="1000000"/> // In kilobytes
```

This line may also be required

``` xml
<requestLimits maxAllowedContentLength="300000000" /> // In bytes
```

The following is an example config file

``` xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<httpRuntime executionTimeout="3000" maxRequestLength="102400"/>
<compilation debug="true" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="300000000" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
```

If you are using `PHP` , you can change the value in the following line in the `php.ini` file:

``` shell
upload_max_filesize = 2M
```
37 changes: 37 additions & 0 deletions indepth/troubleshooting/common-errors/HTTP-request-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting HTTP Request Error
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors, HTTP Request Error
breadcrumbText: HTTP Request Error
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors HTTP Request Error Page
---

# Handling Errors

## HTTP request error

* Symptom

When you upload images via HTTP Put, you may get this error.

* Cause
+ The problem may occur if the write permission is not provided on the server.
+ If you use Tomcat, because the value of the `readonly` property is `false` by default, the HTTP Put operation is not allowed.

* Solution
+ Check the write permission at the server.

- Start Internet Information Services (IIS).
- Click Web Sites.
- Right-click the specified work folder, select Properties.
- Select the Write option at the Directory tab.

+ If you are using Tomcat, the `doPut()` will check to see if the `readonly` property has been changed to `false`. If it has not, the HTTP Put operation is not allowed. Please go to {Tomcat installation directory} -> conf -> web.xml, find the default servlet configuration (org.apache.catalina.servlets. DefaultServlet) and change the `readonly` property to `true` .

``` xml
<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
```
38 changes: 38 additions & 0 deletions indepth/troubleshooting/common-errors/JPEG-compression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting Only 24-bit True Color bmp And 8-bit gray-scaled Image Are Supported For JPEG Compression
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors, JPEG Compression
breadcrumbText: JPEG Compression
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors JPEG Compression Page
---

# Handling Errors

## Only 24-bit true color bmp and 8-bit gray-scaled image are supported for JPEG compression

* Symptom

When you save or upload an image as a JPEG file, you may receive the error.

* Cause

You are saving a Black&White image as a JPEG file but JPEG standard only allows the compression of grayscale and RGB images.

* Resolution

Make sure the pixel type of the image in the buffer is Gray or RGB. If it is not, you can either save it in another format or convert the image to grayscale using the method [ConvertToGrayScale()]({{site.info}}api/WebTwain_Edit.html#converttograyscale).

``` javascript
if ( /*If save in JPEG*/ ) {

//Check whether the current image is B&W
//1 is B&W, 8 is Gray, 24 is RGB
if (DWObject.GetImageBitDepth(DWObject.CurrentImageIndexInBuffer) == 1)
//If so, convert the image to Gray
DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer);
//Save image in JPEG
DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer);

}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting XMLHttpRequest Cannot Load XXX
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors, XMLHttpRequest Cannot Load XXX
breadcrumbText: XMLHttpRequest Cannot Load
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors XMLHttpRequest Cannot Load XXX
---

# Handling Errors

## XMLHttpRequest cannot load XXX

* Symptom

You get the error

``` shell
XMLHttpRequest cannot load xxxxx. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xxxxxxx' is therefore not allowed access.
```

* Cause

You are uploading or downloading to/from a web server which is in a different domain than your current website and that web server doesn't allow accessing from a different domain.

* Solution

Try uploading to the same domain or update the server side configuration to allow cross domain requests. If you are using IIS, you can refer to the following configuration.

``` xml
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="OPTIONS, POST, GET, PUT" />
<add name="Access-Control-Allow-Headers" value="x-requested-with" />
<add name="Access-Control-Allow-Credentials" value="true" />
</customHeaders>
</httpProtocol>
</system.webServer>
```

> Note
>
> After updating the server configuration file, you'll need to restart the server (i.e. IIS).
>
> If you are downloading a file, you might need to clear the browser cache because a cached file will not be requested again from the server, thus still no 'Access-Control-Allow-Origin' header will be presented.
>
> If you are using Windows Authentication, you may need to change the default setting of `withCredentials` in the `dynamsoft.webtwain.initiate.js` file. To do that, open the JS file, find `withCredentials:false` and change it to `withCredentials:true` .
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting A Connection With The Server Could Not Be Established
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors, Connection Couldn't Be Established
breadcrumbText: Connection Couldn't Be Established
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors Connection Couldn't Be Established Page
---

# Handling Errors

## A connection with the server could not be established

* Symptom

When you upload images to your web server, you may receive the error message.

* Cause

The problem may occur when a connection with the server is not available.

* Resolution
+ Check if the HTTP port you set in your code coincides with the port number you set on your web server. You can use the [HTTPPort]({{site.info}}api/WebTwain_IO.html#httpport) property to set the port number.
+ Make sure the address of the server is available. To check this, you can ping the address from a client machine.

> Note:
> Both the machine name and the IP address of the server can be used for the HTTPUpload method.
43 changes: 43 additions & 0 deletions indepth/troubleshooting/common-errors/dwt-md5-is-not-allowed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting Request Header Field dwt-md5 Is Not Allowed By Access-Control-Allow-Headers In Preflight Response
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors, dwt-md5 Is Not Allowed
breadcrumbText: dwt-md5 Is Not Allowed
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors dwt-md5 Is Not Allowed Page
---

# Handling Errors

## Request header field dwt-md5 is not allowed by Access-Control-Allow-Headers in preflight response

* Symptom

When you fail to upload images, you may get this error

* Cause

`dwt-md5` is a default built-in header in `DWT` . It is used for each uploading process to test the integrity of data. Since this is not a standard header, the browser will send an OPTIONS preflight request before the original request is sent to verify that this header is allowed. If not, the browser will return the above error.

* Solution

Update your server-side configuration file as per your environment. If you are using IIS, you can refer to the following configuration.

``` xml
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="OPTIONS, POST, GET, PUT" />
<add name="Access-Control-Allow-Headers" value="x-requested-with, dwt-md5" />
<add name="Access-Control-Allow-Credentials" value="true" />
</customHeaders>
</httpProtocol>
</system.webServer>
```

> Note
>
> After updating the server configuration file, you'll need to restart the server (i.e. IIS).

Check out more info [here](https://fetch.spec.whatwg.org/#http-cors-protocol)
33 changes: 33 additions & 0 deletions indepth/troubleshooting/common-errors/general-failure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting General Failure
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors, General Failure
breadcrumbText: General Failure
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors General Failure Page
---

# Handling Errors

## General failure

* Symptom

When you try scanning an image with Dynamic Web TWAIN, you may receive the error message "General failure" in the ErrorString property.

* Cause

The problem occurs when the source (scanner) is *not* disabled completely after a scanning session or the source is currently unavailable.

* Resolution

You can set [IfDisableSourceAfterAcquire]({{site.info}}api/WebTwain_Acquire.html#ifdisablesourceafteracquire) to `true` . It must be set before the call to [SelectSource]({{site.info}}api/WebTwain_Acquire.html#selectsource)

``` javascript
function AcquireImage() {
DWObject.IfDisableSourceAfterAcquire = true;
DWObject.SelectSource();
DWObject.OpenSource();
DWObject.AcquireImage();
}
```
31 changes: 31 additions & 0 deletions indepth/troubleshooting/common-errors/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
layout: default-layout
needAutoGenerateSidebar: true
title: Dynamic Web TWAIN Troubleshooting Common Errors
keywords: Dynamic Web TWAIN, Documentation, Troubleshooting, Common Errors
breadcrumbText: Common Errors
description: Dynamic Web TWAIN SDK Documentation Troubleshooting Common Errors Index Page
---

# Common Errors

## [General failure]({{site.indepth}}troubleshooting/common-errors/general-failure.html)

## [A connection with the server could not be established]({{site.indepth}}troubleshooting/common-errors/connection-couldn't-be-established.html)

## [HTTP process error]({{site.indepth}}troubleshooting/common-errors/HTTP-process-error.html)

## [HTTP request error]({{site.indepth}}troubleshooting/common-errors/HTTP-request-error.html)

## [Only 24-bit true color bmp and 8-bit gray-scaled image are supported for JPEG compression]({{site.indepth}}troubleshooting/common-errors/JPEG-compression.html)

## [XMLHttpRequest cannot load XXX]({{site.indepth}}troubleshooting/common-errors/XMLHttpRequest-cannot-load.html)

## [Source is connected to the maximum supported number of applications]({{site.indepth}}troubleshooting/common-errors/source-connected-to-maximum.html)

## [Sequence error]({{site.indepth}}troubleshooting/common-errors/sequence-error.html)

## [Request header field dwt-md5 is not allowed by Access-Control-Allow-Headers in preflight response]({{site.indepth}}troubleshooting/common-errors/dwt-md5-is-not-allowed.html)



Loading