Skip to content

Commit 41a08a4

Browse files
update to internal commit 79c400e6
1 parent 7fa5b43 commit 41a08a4

File tree

7 files changed

+234
-234
lines changed

7 files changed

+234
-234
lines changed

articles/general-usage/scanner-image-acquisition.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Finally, `AcquireImageAsync()` closes the data source after completing the scan,
8888

8989
```JS
9090
function AcquireImage() {
91-
if (DWTObject) {
92-
DWTObject.SelectSourceAsync(Dynamsoft.DWT.EnumDWT_DeviceType.ESCLSCANNER)
91+
if (DWTObject) {
92+
DWTObject.SelectSourceAsync(Dynamsoft.DWT.EnumDWT_DeviceType.ESCLSCANNER)
9393
.then(function () {
9494
return DWTObject.AcquireImageAsync({
9595
IfCloseSourceAfterAcquire: true,
@@ -98,7 +98,7 @@ function AcquireImage() {
9898
.catch(function (exp) {
9999
alert(exp.message);
100100
});
101-
}
101+
}
102102
}
103103
```
104104

@@ -114,8 +114,8 @@ Modifying the previous `AcquireImage()` function results in this:
114114

115115
```JS
116116
function AcquireImage() {
117-
if (DWTObject) {
118-
DWTObject.SelectSourceAsync()
117+
if (DWTObject) {
118+
DWTObject.SelectSourceAsync()
119119
.then(function () {
120120
return DWTObject.AcquireImageAsync({
121121
IfShowUI: false,
@@ -127,7 +127,7 @@ function AcquireImage() {
127127
.catch(function (exp) {
128128
alert(exp.message);
129129
});
130-
}
130+
}
131131
}
132132
```
133133

articles/hello-world/editing.md

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ Add this line in the `HelloWorld.html` body to create a color mode conversion bu
2727

2828
```html
2929
<input
30-
type="button"
31-
value="Convert to binary image"
32-
onclick="binarizeImage();"
30+
type="button"
31+
value="Convert to binary image"
32+
onclick="binarizeImage();"
3333
/>
3434
```
3535

3636
Then, define `binarizeImage()` in the `script` element:
3737

3838
```js
3939
function binarizeImage() {
40-
DWTObject.ConvertToBW(DWTObject.CurrentImageIndexInBuffer);
40+
DWTObject.ConvertToBW(DWTObject.CurrentImageIndexInBuffer);
4141
}
4242
```
4343

@@ -59,10 +59,10 @@ Define the rotation functions in the `script` element:
5959

6060
```js
6161
function rotateCW() {
62-
DWTObject.RotateRight(DWTObject.CurrentImageIndexInBuffer);
62+
DWTObject.RotateRight(DWTObject.CurrentImageIndexInBuffer);
6363
}
6464
function rotateCCW() {
65-
DWTObject.RotateLeft(DWTObject.CurrentImageIndexInBuffer);
65+
DWTObject.RotateLeft(DWTObject.CurrentImageIndexInBuffer);
6666
}
6767
```
6868

@@ -76,90 +76,90 @@ APIs used:
7676

7777
```html
7878
<html>
79-
<head>
80-
<script src="Resources/dynamsoft.webtwain.initiate.js"></script>
81-
<script src="Resources/dynamsoft.webtwain.config.js"></script>
82-
</head>
83-
84-
<body>
85-
<input type="button" value="Scan" onclick="AcquireImage();" />
86-
<input type="button" value="upload" onclick="upload();" />
87-
<div id="dwtcontrolContainer"></div>
88-
<input
89-
type="button"
90-
value="Convert to binary image"
91-
onclick="binarizeImage();"
92-
/>
93-
<input type="button" value="Rotate clockwise" onclick="rotateCW();" />
94-
<input
95-
type="button"
96-
value="Rotate counter-clockwise"
97-
onclick="rotateCCW();"
98-
/>
99-
100-
<script type="text/javascript">
101-
var DWTObject;
102-
103-
Dynamsoft.DWT.RegisterEvent("OnWebTwainReady", function () {
104-
DWTObject = Dynamsoft.DWT.GetWebTwain("dwtcontrolContainer");
105-
});
106-
107-
function AcquireImage() {
108-
if (DWTObject) {
109-
DWTObject.SelectSourceAsync()
110-
.then(function () {
111-
return DWTObject.AcquireImageAsync({
112-
IfCloseSourceAfterAcquire: true,
113-
IfShowUI: false,
114-
PixelType: Dynamsoft.DWT.EnumDWT_PixelType.TWPT_GRAY,
115-
Resolution: 150,
116-
});
117-
})
118-
.catch(function (exp) {
119-
alert(exp.message);
120-
});
121-
}
122-
}
123-
124-
function upload() {
125-
if (DWTObject && DWTObject.HowManyImagesInBuffer > 0) {
126-
var strUrl = "https://demo.dynamsoft.com/sample-uploads/";
127-
var imgAry = [DWTObject.CurrentImageIndexInBuffer];
128-
DWTObject.HTTPUpload(
129-
strUrl,
130-
imgAry,
131-
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
132-
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
133-
"WebTWAINImage.png",
134-
onUploadSuccess,
135-
onUploadFailure
136-
);
137-
} else {
138-
alert("There is no image in buffer.");
139-
}
140-
}
141-
142-
function onUploadSuccess() {
143-
alert("Upload successful");
144-
}
145-
146-
function onUploadFailure(errorCode, errorString, sHttpResponse) {
147-
alert(sHttpResponse.length > 0 ? sHttpResponse : errorString);
148-
}
149-
150-
function binarizeImage() {
151-
DWTObject.ConvertToBW(DWTObject.CurrentImageIndexInBuffer);
152-
}
153-
154-
function rotateCW() {
155-
DWTObject.RotateRight(DWTObject.CurrentImageIndexInBuffer);
156-
}
157-
158-
function rotateCCW() {
159-
DWTObject.RotateLeft(DWTObject.CurrentImageIndexInBuffer);
160-
}
161-
</script>
162-
</body>
79+
<head>
80+
<script src="Resources/dynamsoft.webtwain.initiate.js"></script>
81+
<script src="Resources/dynamsoft.webtwain.config.js"></script>
82+
</head>
83+
84+
<body>
85+
<input type="button" value="Scan" onclick="AcquireImage();" />
86+
<input type="button" value="upload" onclick="upload();" />
87+
<div id="dwtcontrolContainer"></div>
88+
<input
89+
type="button"
90+
value="Convert to binary image"
91+
onclick="binarizeImage();"
92+
/>
93+
<input type="button" value="Rotate clockwise" onclick="rotateCW();" />
94+
<input
95+
type="button"
96+
value="Rotate counter-clockwise"
97+
onclick="rotateCCW();"
98+
/>
99+
100+
<script type="text/javascript">
101+
var DWTObject;
102+
103+
Dynamsoft.DWT.RegisterEvent("OnWebTwainReady", function () {
104+
DWTObject = Dynamsoft.DWT.GetWebTwain("dwtcontrolContainer");
105+
});
106+
107+
function AcquireImage() {
108+
if (DWTObject) {
109+
DWTObject.SelectSourceAsync()
110+
.then(function () {
111+
return DWTObject.AcquireImageAsync({
112+
IfCloseSourceAfterAcquire: true,
113+
IfShowUI: false,
114+
PixelType: Dynamsoft.DWT.EnumDWT_PixelType.TWPT_GRAY,
115+
Resolution: 150,
116+
});
117+
})
118+
.catch(function (exp) {
119+
alert(exp.message);
120+
});
121+
}
122+
}
123+
124+
function upload() {
125+
if (DWTObject && DWTObject.HowManyImagesInBuffer > 0) {
126+
var strUrl = "https://demo.dynamsoft.com/sample-uploads/";
127+
var imgAry = [DWTObject.CurrentImageIndexInBuffer];
128+
DWTObject.HTTPUpload(
129+
strUrl,
130+
imgAry,
131+
Dynamsoft.DWT.EnumDWT_ImageType.IT_PNG,
132+
Dynamsoft.DWT.EnumDWT_UploadDataFormat.Binary,
133+
"WebTWAINImage.png",
134+
onUploadSuccess,
135+
onUploadFailure
136+
);
137+
} else {
138+
alert("There is no image in buffer.");
139+
}
140+
}
141+
142+
function onUploadSuccess() {
143+
alert("Upload successful");
144+
}
145+
146+
function onUploadFailure(errorCode, errorString, sHttpResponse) {
147+
alert(sHttpResponse.length > 0 ? sHttpResponse : errorString);
148+
}
149+
150+
function binarizeImage() {
151+
DWTObject.ConvertToBW(DWTObject.CurrentImageIndexInBuffer);
152+
}
153+
154+
function rotateCW() {
155+
DWTObject.RotateRight(DWTObject.CurrentImageIndexInBuffer);
156+
}
157+
158+
function rotateCCW() {
159+
DWTObject.RotateLeft(DWTObject.CurrentImageIndexInBuffer);
160+
}
161+
</script>
162+
</body>
163163
</html>
164164
```
165165

0 commit comments

Comments
 (0)