Skip to content

Commit a4b3c93

Browse files
authored
Update helloworld.md
1 parent ca08136 commit a4b3c93

File tree

1 file changed

+62
-55
lines changed

1 file changed

+62
-55
lines changed

getstarted/helloworld.md

Lines changed: 62 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Embed the script of the library and add an element on the page.
3535
``` html
3636
<script src="Resources/dynamsoft.webtwain.initiate.js"></script>
3737
<script src="Resources/dynamsoft.webtwain.config.js"></script>
38+
<script src="Resources/addon/dynamsoft.webtwain.addon.camera.js"></script>
3839
```
3940

4041
``` html
@@ -79,26 +80,27 @@ Change the function `AcquireImage()` like this
7980
function AcquireImage() {
8081
if (DWObject) {
8182
if (Dynamsoft.Lib.env.bMobile) {
82-
var showVideoConfigs = {
83-
scannerViewer:{
84-
autoDetect:{
85-
enableAutoDetect: true
86-
}
87-
},
88-
filterViewer: {
89-
exitDocumentScanAfterSave: true
90-
}
91-
};
92-
93-
if (DWObject) {
94-
if(!DWObject.UseLocalService) {
95-
DWObject.Addon.Camera.scanDocument(showVideoConfigs).then(
96-
function(){console.log("OK");},
97-
function(error){console.log(error.message);});
98-
}
99-
}
100-
}
101-
}
83+
var showVideoConfigs = {
84+
scannerViewer:{
85+
autoDetect:{
86+
enableAutoDetect: true
87+
}
88+
},
89+
filterViewer: {
90+
exitDocumentScanAfterSave: true
91+
}
92+
};
93+
94+
if(!DWObject.UseLocalService) {
95+
DWObject.Addon.Camera.scanDocument(showVideoConfigs).then(
96+
function(){
97+
console.log("OK");
98+
},
99+
function(error){
100+
console.log(error.message);
101+
});
102+
}
103+
}
102104
else {
103105
DWObject.SelectSource(
104106
function() {
@@ -108,8 +110,8 @@ function AcquireImage() {
108110
function() {
109111
console.log("SelectSource failed!");
110112
});
111-
}
112-
}
113+
}
114+
}
113115
}
114116
```
115117

@@ -122,6 +124,9 @@ function AcquireImage() {
122124
<title>Hello World</title>
123125
<script src="Resources/dynamsoft.webtwain.initiate.js"></script>
124126
<script src="Resources/dynamsoft.webtwain.config.js"></script>
127+
<script src="Resources/addon/dynamsoft.webtwain.addon.camera.js"></script>
128+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
129+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
125130
</head>
126131

127132
<body>
@@ -134,40 +139,42 @@ function AcquireImage() {
134139
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer');
135140
}
136141
137-
function AcquireImage() {
138-
if (DWObject) {
139-
if (Dynamsoft.Lib.env.bMobile) {
140-
var showVideoConfigs = {
141-
scannerViewer:{
142-
autoDetect:{
143-
enableAutoDetect: true
144-
}
145-
},
146-
filterViewer: {
147-
exitDocumentScanAfterSave: true
142+
function AcquireImage() {
143+
if (DWObject) {
144+
if (Dynamsoft.Lib.env.bMobile) {
145+
var showVideoConfigs = {
146+
scannerViewer:{
147+
autoDetect:{
148+
enableAutoDetect: true
148149
}
149-
};
150-
151-
if (DWObject) {
152-
if(!DWObject.UseLocalService) {
153-
DWObject.Addon.Camera.scanDocument(showVideoConfigs).then(
154-
function(){console.log("OK");},
155-
function(error){console.log(error.message);});
156-
}
157-
}
158-
}
159-
else {
160-
DWObject.SelectSource(function() {
161-
DWObject.OpenSource();
162-
DWObject.AcquireImage();
163-
},
164-
function() {
165-
console.log("SelectSource failed!");
166-
}
167-
);
168-
}
169-
}
170-
}
150+
},
151+
filterViewer: {
152+
exitDocumentScanAfterSave: true
153+
}
154+
};
155+
156+
if(!DWObject.UseLocalService) {
157+
DWObject.Addon.Camera.scanDocument(showVideoConfigs).then(
158+
function(){
159+
console.log("OK");
160+
},
161+
function(error){
162+
console.log(error.message);
163+
});
164+
}
165+
}
166+
else {
167+
DWObject.SelectSource(
168+
function() {
169+
DWObject.OpenSource();
170+
DWObject.AcquireImage();
171+
},
172+
function() {
173+
console.log("SelectSource failed!");
174+
});
175+
}
176+
}
177+
}
171178
</script>
172179
</body>
173180

0 commit comments

Comments
 (0)