Skip to content

Commit c34c472

Browse files
committed
fix sth
1 parent f610c29 commit c34c472

15 files changed

+369
-3
lines changed

_includes/sidelist-indepth/troubleshooting.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22
<ul>
33
{%- if page.url contains '/indepth/troubleshooting/' -%}
44
<li><a href="{{ site.indepth }}troubleshooting/debug.html" class="otherLinkColour">How to Debug</a></li>
5-
<li><a href="{{ site.indepth }}troubleshooting/Handle-Errors.html" class="otherLinkColour">Handle Errors</a></li>
5+
<li><a href="{{ site.indepth }}troubleshooting/license-errors/" class="otherLinkColour">License Errors</a></li>
6+
<ul>
7+
<li><a href="{{ site.indepth }}troubleshooting/license-errors/invalid-key.html" class="otherLinkColour">Invalid License</a></li>
8+
<li><a href="{{ site.indepth }}troubleshooting/license-errors/Domain-does-not-match.html" class="otherLinkColour">Domain Doesn't Match</a></li>
9+
<li><a href="{{ site.indepth }}troubleshooting/license-errors/key-expired.html" class="otherLinkColour">License Expired</a></li>
10+
<li><a href="{{ site.indepth }}troubleshooting/license-errors/OCR-lic-exceeded.html" class="otherLinkColour">OCR License Exceeded</a></li>
11+
</ul>
12+
<li><a href="{{ site.indepth }}troubleshooting/common-errors/" class="otherLinkColour">Common Errors</a></li>
13+
<ul>
14+
<li><a href="{{ site.indepth }}troubleshooting/common-errors/general-failure.html" class="otherLinkColour">General failure</a></li>
15+
<li><a href="{{ site.indepth }}troubleshooting/common-errors/connection-couldn't-be-established.html" class="otherLinkColour">Connection Couldn't Be Established</a></li>
16+
<li><a href="{{ site.indepth }}troubleshooting/common-errors/HTTP-process-error.html" class="otherLinkColour">HTTP Process Error</a></li>
17+
<li><a href="{{ site.indepth }}troubleshooting/common-errors/HTTP-request-error.html" class="otherLinkColour">HTTP Request Error</a></li>
18+
</ul>
619
{%- endif -%}
720
</ul>
821
</li>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Handling Errors
2+
3+
## HTTP process error
4+
5+
* Symptom
6+
7+
When you upload images using any of the HTTPUploadThroughPost*** methods, you may receive the error.
8+
9+
* Cause
10+
+ The write permission is not granted to the specified directory on the web server.
11+
+ The action page is incorrect or returns something from the web server.
12+
+ The port specified for uploading is the incorrect one.
13+
+ The size of the images you are trying to upload is beyond the maximum allowed size set by the server.
14+
15+
* Solution
16+
+ 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.)
17+
+ 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.
18+
+ 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:
19+
20+
``` javascript
21+
var strHTTPServer = location.hostname;
22+
DWObject.HTTPPort = location.port == "" ? 80 : location.port;
23+
```
24+
+ 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,
25+
26+
``` javascript
27+
DWObject.IfSSL = true;
28+
DWObject.HTTPPort = 443;
29+
```
30+
> For example: If the URL for the scan page is "http://localhost:3253/....", you should set the port to 3253.
31+
32+
* Checking the server-side configuration is also useful in this scenario
33+
+ 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.
34+
35+
``` xml
36+
<httpRuntime maxRequestLength="1000000"/> // In kilobytes
37+
```
38+
39+
This line may also be required
40+
41+
``` xml
42+
<requestLimits maxAllowedContentLength="300000000" /> // In bytes
43+
```
44+
45+
The following is an example config file
46+
47+
``` xml
48+
<?xml version="1.0" encoding="UTF-8"?>
49+
<configuration>
50+
<system.web>
51+
<httpRuntime executionTimeout="3000" maxRequestLength="102400"/>
52+
<compilation debug="true" />
53+
</system.web>
54+
<system.webServer>
55+
<security>
56+
<requestFiltering>
57+
<requestLimits maxAllowedContentLength="300000000" />
58+
</requestFiltering>
59+
</security>
60+
</system.webServer>
61+
</configuration>
62+
```
63+
64+
If you are using `PHP` , you can change the value in the following line in the `php.ini` file:
65+
66+
``` shell
67+
upload_max_filesize = 2M
68+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Handling Errors
2+
3+
## HTTP request error
4+
5+
* Symptom
6+
7+
When you upload images via HTTP Put, you may get this error.
8+
9+
* Cause
10+
+ The problem may occur if the write permission is not provided on the server.
11+
+ If you use Tomcat, because the value of the `readonly` property is `false` by default, the HTTP Put operation is not allowed.
12+
13+
* Solution
14+
+ Check the write permission at the server.
15+
16+
- Start Internet Information Services (IIS).
17+
- Click Web Sites.
18+
- Right-click the specified work folder, select Properties.
19+
- Select the Write option at the Directory tab.
20+
21+
+ 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` .
22+
23+
``` xml
24+
<init-param>
25+
<param-name>readonly</param-name>
26+
<param-value>false</param-value>
27+
</init-param>
28+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Handling Errors
2+
3+
## Only 24-bit true color bmp and 8-bit gray-scaled image are supported for JPEG compression
4+
5+
* Symptom
6+
7+
When you save or upload an image as a JPEG file, you may receive the error.
8+
9+
* Cause
10+
11+
You are saving a Black&White image as a JPEG file but JPEG standard only allows the compression of grayscale and RGB images.
12+
13+
* Resolution
14+
15+
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).
16+
17+
``` javascript
18+
if ( /*If save in JPEG*/ ) {
19+
20+
//Check whether the current image is B&W
21+
//1 is B&W, 8 is Gray, 24 is RGB
22+
if (DWObject.GetImageBitDepth(DWObject.CurrentImageIndexInBuffer) == 1)
23+
//If so, convert the image to Gray
24+
DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer);
25+
//Save image in JPEG
26+
DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer);
27+
28+
}
29+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Handling Errors
2+
3+
## XMLHttpRequest cannot load XXX
4+
5+
* Symptom
6+
7+
You get the error
8+
9+
``` shell
10+
XMLHttpRequest cannot load xxxxx. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xxxxxxx' is therefore not allowed access.
11+
```
12+
13+
* Cause
14+
15+
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.
16+
17+
* Solution
18+
19+
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.
20+
21+
``` xml
22+
<system.webServer>
23+
<httpProtocol>
24+
<customHeaders>
25+
<add name="Access-Control-Allow-Origin" value="*" />
26+
<add name="Access-Control-Allow-Methods" value="OPTIONS, POST, GET, PUT" />
27+
<add name="Access-Control-Allow-Headers" value="x-requested-with" />
28+
<add name="Access-Control-Allow-Credentials" value="true" />
29+
</customHeaders>
30+
</httpProtocol>
31+
</system.webServer>
32+
```
33+
34+
> Note
35+
>
36+
> After updating the server configuration file, you'll need to restart the server (i.e. IIS).
37+
>
38+
> 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.
39+
>
40+
> 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` .
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Handling Errors
2+
3+
## A connection with the server could not be established
4+
5+
* Symptom
6+
7+
When you upload images to your web server, you may receive the error message.
8+
9+
* Cause
10+
11+
The problem may occur when a connection with the server is not available.
12+
13+
* Resolution
14+
+ 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.
15+
+ Make sure the address of the server is available. To check this, you can ping the address from a client machine.
16+
17+
> Note:
18+
> Both the machine name and the IP address of the server can be used for the HTTPUpload method.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Handling Errors
2+
3+
## Request header field dwt-md5 is not allowed by Access-Control-Allow-Headers in preflight response
4+
5+
* Symptom
6+
7+
When you fail to upload images, you may get this error
8+
9+
* Cause
10+
11+
`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.
12+
13+
* Solution
14+
15+
Update your server-side configuration file as per your environment. If you are using IIS, you can refer to the following configuration.
16+
17+
``` xml
18+
<system.webServer>
19+
<httpProtocol>
20+
<customHeaders>
21+
<add name="Access-Control-Allow-Origin" value="*" />
22+
<add name="Access-Control-Allow-Methods" value="OPTIONS, POST, GET, PUT" />
23+
<add name="Access-Control-Allow-Headers" value="x-requested-with, dwt-md5" />
24+
<add name="Access-Control-Allow-Credentials" value="true" />
25+
</customHeaders>
26+
</httpProtocol>
27+
</system.webServer>
28+
```
29+
30+
> Note
31+
>
32+
> After updating the server configuration file, you'll need to restart the server (i.e. IIS).
33+
34+
Check out more info [here](https://fetch.spec.whatwg.org/#http-cors-protocol)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Handling Errors
2+
3+
## General failure
4+
5+
* Symptom
6+
7+
When you try scanning an image with Dynamic Web TWAIN, you may receive the error message "General failure" in the ErrorString property.
8+
9+
* Cause
10+
11+
The problem occurs when the source (scanner) is *not* disabled completely after a scanning session or the source is currently unavailable.
12+
13+
* Resolution
14+
15+
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)
16+
17+
``` javascript
18+
function AcquireImage() {
19+
DWObject.IfDisableSourceAfterAcquire = true;
20+
DWObject.SelectSource();
21+
DWObject.OpenSource();
22+
DWObject.AcquireImage();
23+
}
24+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Handling Errors
2+
3+
## Sequence error
4+
5+
* Symptom
6+
7+
When you fail to acquire images from your scanner, you may get this error.
8+
9+
* Cause
10+
11+
The problem happens when the process does not occur in the correct TWAIN sequence.
12+
13+
* Resolution
14+
15+
Check if you followed the acquisition sequence to get images from your device. For example, some methods and properties, like the [PixelType]({{site.info}}api/WebTwain_Acquire.html#pixeltype) property, can only be used after calling the [OpenSource()]({{site.info}}api/WebTwain_Acquire.html#opensource) method. Please check the TWAIN State Transition Diagram below for more information
16+
17+
![TWAIN State Transition]({{site.assets}}imgs/TWAIN-State-Transition.png)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Handling Errors
2+
3+
## Source is connected to the maximum supported number of applications
4+
5+
* Symptom
6+
7+
When you try to acquire images, you may get this error.
8+
9+
* Cause
10+
11+
The problem may occur when the source is **not** disabled completely after a transfer ends or is used by other applications.
12+
13+
* Resolution
14+
+ Check whether another application is using the source. If yes, close it and try again.
15+
+ Set [IfDisableSourceAfterAcquire]({{site.info}}api/WebTwain_Acquire.html#ifdisablesourceafteracquire) to `true` and use [CloseSource()]({{site.info}}api/WebTwain_Acquire.html#closesource) to make sure that the source is closed after a scanning session.
16+
17+
``` javascript
18+
function btnScan_onclick() {
19+
DWObject.RegisterEvent("OnPostAllTransfers", function() {
20+
DWObject.CloseSource();
21+
});
22+
DWObject.SelectSource();
23+
DWObject.CloseSource(); //close source before open
24+
DWObject.OpenSource();
25+
DWObject.IfDisableSourceAfterAcquire = true; //close source after acquiring
26+
DWObject.AcquireImage();
27+
}
28+
```
29+
Reboot your device.

0 commit comments

Comments
 (0)