Skip to content

Commit ca08136

Browse files
authored
Merge pull request #165 from icfung828/master
updates for Save in WASM mode
2 parents 40daeeb + c97551f commit ca08136

File tree

2 files changed

+22
-28
lines changed

2 files changed

+22
-28
lines changed

indepth/features/output.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ DWObject.FTPUpload(
277277

278278
### Show dialog to save
279279

280-
> Supported on [desktop]({{site.getstarted}}platform.html#browsers-on-desktop-devices).
281-
282280
You can set the [ `IfShowFileDialog` ]({{site.info}}api/WebTwain_IO.html#ifshowfiledialog) property to `true` , which will show the open/save file dialog whenever you save an image(s) within the `DWT` buffer
283281

284282
``` javascript
@@ -296,8 +294,6 @@ DWObject.SaveAllAsPDF("Sample.pdf",
296294

297295
### Save to an absolute path
298296

299-
> Supported on [desktop]({{site.getstarted}}platform.html#browsers-on-desktop-devices).
300-
301297
If you don't want to show any dialog and you know for sure where you want the files saved, you can save with absolute paths while setting [ `IfShowFileDialog` ]({{site.info}}api/WebTwain_IO.html#ifshowfiledialog) to `false` .
302298

303299
> When using an absolute path, you must make sure the current user has the proper permission to save to that path. Otherwise the save will fail.
@@ -314,28 +310,6 @@ DWObject.SaveAllAsPDF("D:\\Sample.pdf",
314310
);
315311
```
316312

317-
### Save as a download
318-
319-
> Supported on [WASM browsers]({{site.getstarted}}platform.html#wasm-browsers).
320-
321-
In [WASM browsers]({{site.getstarted}}platform.html#wasm-browsers), `DWT` runs its entire operations within the browser. So saving locally triggers will instead download the file and [ `IfShowFileDialog` ]({{site.info}}api/WebTwain_IO.html#ifshowfiledialog) will have no effect.
322-
323-
``` javascript
324-
// The following line only works on desktop but it
325-
// doesn't throw errors on WASM browsers either
326-
DWObject.IfShowFileDialog = false;
327-
// The following line specifies an absolute path but
328-
// only the name 'Sample.pdf' is used in WASM browsers
329-
DWObject.SaveAllAsPDF("D:\\Sample.pdf",
330-
function() {
331-
console.log('Successful!');
332-
},
333-
function(errCode, errString) {
334-
console.log(errString);
335-
}
336-
);
337-
```
338-
339313
### Save multiple files to the same location
340314

341315
If you want the user to choose a file path once and then save multiple images to that location, you can do so via the [ `OnGetFilePath` ]({{site.info}}api/WebTwain_IO.html#ongetfilepath) event.
@@ -370,6 +344,26 @@ DWObject.SaveAsJPEG("Sample.jpg", 0,
370344
);
371345
```
372346

347+
### Save in [WASM mode]({{site.indepth}}features/initialize.html?ver=latest#webassembly-edition)
348+
349+
In [WASM mode]({{site.indepth}}features/initialize.html?ver=latest#webassembly-edition), `DWT` runs its entire operations within desktop/mobile browsers. As a result, files are always saved in the system's Downloads folder by default, regardless of the absolute path specified. And the API [ `IfShowFileDialog` ]({{site.info}}api/WebTwain_IO.html#ifshowfiledialog) has no effect in WASM mode.
350+
351+
``` javascript
352+
// The following line will be ignored and
353+
// no file dialog will be shown in WASM mode
354+
DWObject.IfShowFileDialog = true;
355+
// The absolute path specified will be ignored and
356+
// the file is saved to the Downloads folder
357+
DWObject.SaveAllAsPDF("D:\\Sample.pdf",
358+
function() {
359+
console.log('Successful!');
360+
},
361+
function(errCode, errString) {
362+
console.log(errString);
363+
}
364+
);
365+
```
366+
373367
## Convert
374368

375369
In some cases, you want to process the data yourself and want to extract it from the `DWT` buffer. `DWT` offers two approaches.

info/api/WebTwain_Util.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ LogLevel: number;
461461

462462
**Usage notes**
463463

464-
The logs for the Dynamic Web TWAIN library are saved in the directory `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_17\log\` . By default, `LogLevel` is 0 and nothing is recorded. When it is set to 1, all debugging information is recorded.
464+
The logs for the Dynamic Web TWAIN library are saved in the directory `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_17\log\`. By default, `LogLevel` is 0 and nothing is recorded. When it is set to 1, all debugging information is recorded. This setting in your application will apply to all machines.
465465

466-
Setting `LogLevel` to 1/0 is equivalent to setting `LogLevel` to 14/1 in the file `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_17\DSConfiguration.ini` .
466+
To enable logging on a specific machine, you can set `LogLevel` to 14 in this file: `C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_17\DSConfiguration.ini`.
467467

468468
---
469469

0 commit comments

Comments
 (0)