dwt 17.3.4 → 17.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * Copyright 2022, Dynamsoft Corporation
16
16
  * Author: Dynamsoft Support Team
17
- * Version: 17.3
17
+ * Version: 17.3.5
18
18
  */
19
19
  import Dynamsoft from "./Dynamsoft";
20
20
  export default Dynamsoft;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dwt",
3
- "version": "17.3.4",
3
+ "version": "17.3.5",
4
4
  "author": {
5
5
  "name": "Dynamsoft",
6
6
  "url": "https://www.dynamsoft.com"
@@ -1,69 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Use Auto Feeder to scan</title>
6
- <script src="../dist/dynamsoft.webtwain.min.js"></script>
7
- </head>
8
-
9
- <body style="padding: 30px;">
10
- <lable id="ADF" style="font-size: x-large;" ><input type="checkbox" checked="checked">Auto Feeder</lable>
11
- <input type="button" style="font-size: x-large;" id="acquireButton" value="Acquire" onclick="AcquireImage();" />
12
- <input type="button" style="font-size: x-large;display:none;" id="mobileFile" value="Acquire" onclick="LoadImage()" />
13
- <!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
14
- If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
15
- <br />
16
- <br />
17
- <div id="dwtcontrolContainer"></div>
18
-
19
- <script type="text/javascript">
20
- Dynamsoft.DWT.ResourcesPath = "../dist";
21
- Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
22
- Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
23
- window.onload = function () {
24
- if (Dynamsoft.Lib.env.bMobile) {
25
- document.getElementById('ADF').style.display = "none";
26
- document.getElementById('acquireButton').style.display = "none";
27
- document.getElementById('mobileFile').style.display = "";
28
- }
29
- Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
30
- Dynamsoft.DWT.Load();
31
- };
32
- var DWObject;
33
-
34
- function Dynamsoft_OnReady() {
35
- DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer');
36
- }
37
-
38
- function AcquireImage() {
39
- if (DWObject) {
40
- DWObject.SelectSource(function () {
41
- DWObject.OpenSource();
42
- DWObject.AcquireImage(
43
- {
44
- IfShowUI: false,
45
- IfFeederEnabled: document.getElementById("ADF").checked,
46
- PixelType: Dynamsoft.DWT.EnumDWT_PixelType.TWPT_RGB,
47
- Resolution: 200,
48
- IfDisableSourceAfterAcquire: true
49
- },
50
- function () {
51
- console.log("Successful!");
52
- },
53
- function (settings, errCode, errString) {
54
- alert(errString)
55
- }
56
- );
57
- }, function () {
58
- alert('SelectSource failed!');
59
- });
60
- }
61
- }
62
-
63
- function LoadImage() {
64
- DWObject.LoadImageEx('', 5);
65
- }
66
- </script>
67
- </body>
68
-
69
- </html>
@@ -1,98 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Custom Scan</title>
6
- <script src="../dist/dynamsoft.webtwain.min.js"></script>
7
- </head>
8
-
9
- <body style="padding: 30px;">
10
- <div id="scanOptions">
11
- <label for="BW" >
12
- <input type="radio" value="0" name="PixelType">B&amp;W </label>
13
- <label for="Gray">
14
- <input type="radio" value="1" name="PixelType">Gray</label>
15
- <label for="RGB">
16
- <input type="radio" value="2" name="PixelType" checked="checked">Color</label>
17
- |
18
-
19
- <label>
20
- <input type="checkbox" id="ADF" checked="checked">Auto Feeder</label>
21
- <label>
22
- <input type="checkbox" id="ShowUI" checked="checked">Show UI
23
- <br />
24
- </label>
25
-
26
- <select id="Resolution">
27
- <option value="100">100</option>
28
- <option value="150">150</option>
29
- <option value="200">200</option>
30
- <option value="300">300</option>
31
- </select>
32
- <select id="source" style="position: relative; width: 220px;"></select>
33
-
34
- <input type="button" value="Scan" onclick="AcquireImage();" />
35
- </div>
36
- <input type="button" id="mobileFile" value="Acquire" style="font-size: x-large;display:none" onclick="LoadImage()" />
37
- <br />
38
- <div id="dwtcontrolContainer"></div>
39
- <script type="text/javascript">
40
- Dynamsoft.DWT.ResourcesPath = "../dist";
41
- Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
42
- Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
43
- window.onload = function () {
44
- if (Dynamsoft.Lib.env.bMobile) {
45
- document.getElementById('scanOptions').style.display = "none";
46
- document.getElementById('mobileFile').style.display = "";
47
- }
48
- Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
49
- Dynamsoft.DWT.Load();
50
- };
51
- var DWObject;
52
-
53
- function Dynamsoft_OnReady() {
54
- DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
55
- if (DWObject) {
56
- var count = DWObject.SourceCount;
57
- for (var i = 0; i < count; i++)
58
- document.getElementById("source").options.add(new Option(DWObject.GetSourceNameItems(i), i));
59
- }
60
- }
61
-
62
- function AcquireImage() {
63
- if (DWObject) {
64
- DWObject.SelectSourceByIndex(document.getElementById("source").selectedIndex);
65
- DWObject.OpenSource();
66
- var pixelType = 2;
67
- var pixelTypeInputs = document.getElementsByName("PixelType");
68
- for (var i = 0; i < pixelTypeInputs.length; i++) {
69
- if (pixelTypeInputs[i].checked) {
70
- pixelType = pixelTypeInputs[i].value;
71
- break;
72
- }
73
- }
74
- DWObject.AcquireImage(
75
- {
76
- IfShowUI: document.getElementById("ShowUI").checked,
77
- IfFeederEnabled: document.getElementById("ADF").checked,
78
- PixelType: pixelType,
79
- Resolution: parseInt(document.getElementById("Resolution").value),
80
- IfDisableSourceAfterAcquire: true
81
- },
82
- function () {
83
- console.log("Successful!");
84
- },
85
- function (settings, errCode, errString) {
86
- alert(errString)
87
- }
88
- );
89
- }
90
- }
91
-
92
- function LoadImage() {
93
- DWObject.LoadImageEx('', 5);
94
- }
95
- </script>
96
- </body>
97
-
98
- </html>
@@ -1,8 +0,0 @@
1
- <html>
2
- <head>
3
- <meta http-equiv="Refresh" content="0;url=https://demo.dynamsoft.com/web-twain/?product=dwt&utm_source=npm">
4
- </head>
5
- <body>
6
- </body>
7
- </html>
8
-
@@ -1,8 +0,0 @@
1
- <html>
2
- <head>
3
- <meta http-equiv="Refresh" content="0;url=https://www.dynamsoft.com/web-twain/resources/code-gallery/?product=dwt&utm_source=npm">
4
- </head>
5
- <body>
6
- </body>
7
- </html>
8
-
package/samples/Edit.html DELETED
@@ -1,111 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Use Dynamic Web TWAIN's Editing features</title>
6
- <script src="../dist/dynamsoft.webtwain.min.js"></script>
7
- </head>
8
-
9
- <body style="padding: 30px;">
10
- <input type="button" style="font-size: x-large;" value="Scan" onclick="AcquireImage();" />
11
- <input type="button" style="font-size: x-large;" value="Load" onclick="LoadImage();" />
12
- <input type="button" style="font-size: x-large;" value="Rotate Left" onclick="RotateLeft();" />
13
- <input type="button" style="font-size: x-large;" value="Rotate Right" onclick="RotateRight();" />
14
- <input type="button" style="font-size: x-large;" value="Mirror" onclick="Mirror();" />
15
- <input type="button" style="font-size: x-large;" value="Flip" onclick="Flip();" />
16
- <input type="button" style="font-size: x-large;" value="Show Image Editor" onclick="ShowImageEditor();" />
17
- <br />
18
- <br />
19
- <!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
20
- If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
21
- <div id="dwtcontrolContainer"></div>
22
-
23
- <script type="text/javascript">
24
- Dynamsoft.DWT.ResourcesPath = "../dist";
25
- Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
26
- window.onload = function () {
27
- Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:700, Height:800}];
28
- Dynamsoft.DWT.Load();
29
- };
30
-
31
- var console = window['console'] ? window['console'] : { 'log': function () { } };
32
- Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
33
-
34
- var DWObject;
35
-
36
- function Dynamsoft_OnReady() {
37
- DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
38
- }
39
-
40
- function AcquireImage() {
41
- if (DWObject) {
42
- DWObject.SelectSource(function () {
43
- var OnAcquireImageSuccess, OnAcquireImageFailure;
44
- OnAcquireImageSuccess = OnAcquireImageFailure = function () {
45
- DWObject.CloseSource();
46
- };
47
-
48
- DWObject.OpenSource();
49
- DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
50
- DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
51
- }, function () {
52
- console.log('SelectSource failed!');
53
- });
54
- }
55
- }
56
-
57
- //Callback functions for async APIs
58
- function OnSuccess() {
59
- console.log('successful');
60
- }
61
-
62
- function OnFailure(errorCode, errorString) {
63
- alert(errorString);
64
- }
65
-
66
- function LoadImage() {
67
- if (DWObject) {
68
- DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
69
- DWObject.LoadImageEx("", Dynamsoft.DWT.EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation
70
- }
71
- }
72
-
73
- function RotateLeft() {
74
- if (DWObject)
75
- if (DWObject.HowManyImagesInBuffer > 0)
76
- DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer);
77
- }
78
-
79
- function RotateRight() {
80
- if (DWObject)
81
- if (DWObject.HowManyImagesInBuffer > 0)
82
- DWObject.RotateRight(DWObject.CurrentImageIndexInBuffer);
83
- }
84
-
85
- function Mirror() {
86
- if (DWObject)
87
- if (DWObject.HowManyImagesInBuffer > 0)
88
- DWObject.Mirror(DWObject.CurrentImageIndexInBuffer);
89
- }
90
-
91
- function Flip() {
92
- if (DWObject)
93
- if (DWObject.HowManyImagesInBuffer > 0)
94
- DWObject.Flip(DWObject.CurrentImageIndexInBuffer);
95
-
96
- }
97
-
98
- function ShowImageEditor() {
99
- if (DWObject) {
100
- if (DWObject.HowManyImagesInBuffer == 0)
101
- alert("There is no image in buffer.");
102
- else{
103
- var imageEditor = DWObject.Viewer.createImageEditor();
104
- imageEditor.show();
105
- }
106
- }
107
- }
108
- </script>
109
- </body>
110
-
111
- </html>
@@ -1,103 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Use Dynamic Web TWAIN to load and save images</title>
6
- <script src="../dist/dynamsoft.webtwain.min.js"></script>
7
- </head>
8
-
9
- <body style="padding: 30px;">
10
- <input type="button" style="font-size: x-large;" value="Scan and Save" onclick="AcquireImage();" />
11
- <input type="button" style="font-size: x-large;" value="Load" onclick="LoadImage();" />
12
- <input type="button" style="font-size: x-large;" value="Save" onclick="SaveWithFileDialog();" />
13
- <br />
14
- <label style="font-size: x-large;">
15
- <input type="radio" value="jpg" name="ImageType" id="imgTypejpeg" />JPEG</label>
16
- <label style="font-size: x-large;">
17
- <input type="radio" value="tif" name="ImageType" id="imgTypetiff" />TIFF</label>
18
- <label style="font-size: x-large;">
19
- <input type="radio" value="pdf" name="ImageType" id="imgTypepdf" checked="checked" />PDF</label>
20
- <br />
21
- <br />
22
- <!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
23
- If you need to rename the id, you should also change the id in dynamsoft.webtwain.config.js accordingly. -->
24
- <div id="dwtcontrolContainer"></div>
25
-
26
- <script type="text/javascript">
27
- Dynamsoft.DWT.ResourcesPath = "../dist";
28
- Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
29
- window.onload = function () {
30
- Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
31
- Dynamsoft.DWT.Load();
32
- };
33
-
34
- var console = window['console'] ? window['console'] : { 'log': function () { } };
35
- Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
36
-
37
- var DWObject;
38
-
39
- function Dynamsoft_OnReady() {
40
- DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
41
- if (DWObject) {
42
- DWObject.RegisterEvent('OnPostAllTransfers', function(){setTimeout(SaveWithFileDialog,20);});
43
- }
44
- }
45
-
46
- function AcquireImage() {
47
- if (DWObject) {
48
- DWObject.SelectSource(function () {
49
- var OnAcquireImageSuccess, OnAcquireImageFailure;
50
- OnAcquireImageSuccess = OnAcquireImageFailure = function () {
51
- DWObject.CloseSource();
52
- };
53
-
54
- DWObject.OpenSource();
55
- DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
56
- DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
57
- }, function () {
58
- console.log('SelectSource failed!');
59
- });
60
- }
61
- }
62
-
63
- //Callback functions for async APIs
64
- function OnSuccess() {
65
- console.log('successful');
66
- }
67
-
68
- function OnFailure(errorCode, errorString) {
69
- if(errorCode != -2326)
70
- alert(errorString);
71
- }
72
-
73
- function LoadImage() {
74
- if (DWObject) {
75
- DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
76
- DWObject.LoadImageEx("", Dynamsoft.DWT.EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation
77
- }
78
- }
79
-
80
- function SaveWithFileDialog() {
81
- if (DWObject) {
82
- if (DWObject.HowManyImagesInBuffer > 0) {
83
- DWObject.IfShowFileDialog = true;
84
- if (document.getElementById("imgTypejpeg").checked == true) {
85
- //If the current image is B&W
86
- //1 is B&W, 8 is Gray, 24 is RGB
87
- if (DWObject.GetImageBitDepth(DWObject.CurrentImageIndexInBuffer) == 1)
88
- //If so, convert the image to Gray
89
- DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer);
90
- //Save image in JPEG
91
- DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer);
92
- }
93
- else if (document.getElementById("imgTypetiff").checked == true)
94
- DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", OnSuccess, OnFailure);
95
- else if (document.getElementById("imgTypepdf").checked == true)
96
- DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", OnSuccess, OnFailure);
97
- }
98
- }
99
- }
100
- </script>
101
- </body>
102
-
103
- </html>
@@ -1,197 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Dynamic Web TWAIN Navigation Sample</title>
6
- <script src="../dist/dynamsoft.webtwain.min.js"></script>
7
- </head>
8
-
9
- <body style="padding: 30px;">
10
- <select size="1" id="source" style="position: relative; width: 220px;font-size: x-large;"></select>
11
- <input type="button" style="font-size: x-large;" value="Scan" onclick="AcquireImage();" />
12
- <input type="button" style="font-size: x-large;" value="Load" onclick="LoadImage();" />
13
- <br />
14
- <br />
15
- <div style="width: 480px; display: block;">
16
-
17
- <!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
18
- If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
19
- <div id="dwtcontrolContainer"></div>
20
-
21
- <div style="width: 800px;">
22
- <input style="font-size: x-large;" onclick="btnFirstImage_onclick()" type="button" value=" |< " />
23
- <input style="font-size: x-large;" onclick="btnPreImage_onclick()" type="button" value=" < " />
24
- <input style="font-size: x-large;" type="text" size="2" id="DW_CurrentImage" readonly="readonly" value="0" /> /
25
- <input style="font-size: x-large;" type="text" size="2" id="DW_TotalImage" readonly="readonly" value="0" />
26
- <input style="font-size: x-large;" onclick="btnNextImage_onclick()" type="button" value=" > " />
27
- <input style="font-size: x-large;" onclick="btnLastImage_onclick()" type="button" value=" >| " /> Preview Mode:
28
- <select style="font-size: x-large;" size="1" id="DW_PreviewMode" onchange="setlPreviewMode();">
29
- <option value="0">1X1</option>
30
- <option value="1">2X2</option>
31
- <option value="2">3X3</option>
32
- <option value="3">4X4</option>
33
- <option value="4">5X5</option>
34
- </select>
35
- </div>
36
- </div>
37
-
38
- <input style="font-size: x-large;" onclick="btnRemoveSelectedImages_onclick()" type="button" value="Remove Selected Images" />
39
- <input style="font-size: x-large;" onclick="btnRemoveAllImages_onclick()" type="button" value="Remove All Images" />
40
-
41
- <script type="text/javascript">
42
- Dynamsoft.DWT.ResourcesPath = "../dist";
43
- Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
44
- window.onload = function () {
45
- Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:700, Height:600}];
46
- Dynamsoft.DWT.Load();
47
- };
48
- var console = window['console'] ? window['console'] : { 'log': function () { } };
49
-
50
- Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
51
-
52
- var DWObject;
53
-
54
- function Dynamsoft_OnReady() {
55
- DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
56
- if (DWObject) {
57
- var count = DWObject.SourceCount; // Get how many sources are installed in the system
58
-
59
- for (var i = 0; i < count; i++)
60
- document.getElementById("source").options.add(new Option(DWObject.GetSourceNameItems(i), i)); // Add the sources in a drop-down list
61
-
62
- // The event OnPostTransfer fires after each image is scanned and transferred
63
- DWObject.RegisterEvent("OnPostTransfer", function () {
64
- setTimeout(updatePageInfo,20);
65
- });
66
-
67
- // The event OnPostLoad fires after the images from a local directory have been loaded into the control
68
- DWObject.RegisterEvent("OnPostLoad", function () {
69
- setTimeout(updatePageInfo,20);
70
- });
71
-
72
- // The event click fires when the mouse clicks on an image on Dynamic Web TWAIN viewer
73
- DWObject.Viewer.on("click", function () {
74
- updatePageInfo();
75
- });
76
-
77
- // The event topPageChanged fires when the top image currently displayed in the viewer changes
78
- DWObject.Viewer.on("topPageChanged", topPageChanged);
79
- }
80
- }
81
-
82
- function topPageChanged(index){
83
- DWObject.CurrentImageIndexInBuffer = index;
84
- updatePageInfo();
85
- }
86
-
87
- function AcquireImage() {
88
- if (DWObject) {
89
- var OnAcquireImageSuccess, OnAcquireImageFailure;
90
- OnAcquireImageSuccess = OnAcquireImageFailure = function () {
91
- DWObject.CloseSource();
92
- };
93
-
94
- DWObject.SelectSourceByIndex(document.getElementById("source").selectedIndex);
95
- DWObject.OpenSource();
96
- DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
97
- DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
98
- }
99
- }
100
-
101
- //Callback functions for async APIs
102
- function OnSuccess() {
103
- console.log('successful');
104
- }
105
-
106
- function OnFailure(errorCode, errorString) {
107
- alert(errorString);
108
- }
109
-
110
- function LoadImage() {
111
- if (DWObject) {
112
- DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
113
- DWObject.LoadImageEx("", Dynamsoft.DWT.EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation
114
- }
115
- }
116
-
117
- function btnPreImage_onclick() {
118
- if (DWObject) {
119
- DWObject.Viewer.off("topPageChanged", topPageChanged);
120
- DWObject.Viewer.previous();
121
- updatePageInfo();
122
- DWObject.Viewer.on("topPageChanged", topPageChanged);
123
- }
124
- }
125
-
126
- function btnNextImage_onclick() {
127
- if (DWObject) {
128
- DWObject.Viewer.off("topPageChanged", topPageChanged);
129
- DWObject.Viewer.next();
130
- updatePageInfo();
131
- DWObject.Viewer.on("topPageChanged", topPageChanged);
132
- }
133
- }
134
-
135
- function btnFirstImage_onclick() {
136
- if (DWObject) {
137
- DWObject.Viewer.first();
138
- updatePageInfo();
139
- }
140
- }
141
-
142
- function btnLastImage_onclick() {
143
- if (DWObject) {
144
- DWObject.Viewer.off("topPageChanged", topPageChanged);
145
-
146
- DWObject.Viewer.last();
147
- updatePageInfo();
148
-
149
- DWObject.Viewer.on("topPageChanged", topPageChanged);
150
- }
151
- }
152
- function setlPreviewMode() {
153
- if (DWObject) {
154
- var o = parseInt(document.getElementById("DW_PreviewMode").selectedIndex + 1);
155
- DWObject.Viewer.off("topPageChanged", topPageChanged);
156
- DWObject.Viewer.setViewMode(o, o);
157
- if (document.getElementById("DW_PreviewMode").selectedIndex != 0) {
158
- DWObject.Viewer.cursor = "pointer";
159
- }
160
- else {
161
- DWObject.Viewer.cursor = "crosshair";
162
- }
163
- DWObject.Viewer.on("topPageChanged", topPageChanged);
164
- }
165
- }
166
-
167
- function btnRemoveSelectedImages_onclick() {
168
- if (DWObject) {
169
- DWObject.RemoveAllSelectedImages();
170
- if (DWObject.HowManyImagesInBuffer == 0) {
171
- document.getElementById("DW_CurrentImage").value = "0";
172
- document.getElementById("DW_TotalImage").value = "0";
173
- }
174
- else {
175
- updatePageInfo();
176
- }
177
- }
178
- }
179
-
180
- function btnRemoveAllImages_onclick() {
181
- if (DWObject) {
182
- DWObject.RemoveAllImages();
183
- document.getElementById("DW_TotalImage").value = "0";
184
- document.getElementById("DW_CurrentImage").value = "0";
185
- }
186
- }
187
-
188
- function updatePageInfo() {
189
- if (DWObject) {
190
- document.getElementById("DW_TotalImage").value = DWObject.HowManyImagesInBuffer;
191
- document.getElementById("DW_CurrentImage").value = DWObject.CurrentImageIndexInBuffer + 1;
192
- }
193
- }
194
- </script>
195
- </body>
196
-
197
- </html>