Skip to content

Commit d115b2b

Browse files
authored
Merge pull request #912 from dynamsoft-docs/preview
update to internal commit dd6e759d
2 parents 3c5618e + e8d02c2 commit d115b2b

File tree

10 files changed

+115
-374
lines changed

10 files changed

+115
-374
lines changed

CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

TODO.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

_articles/about/resources.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: Dynamic Web TWAIN SDK Documentation Resources Page
1111

1212
## Where to get Dynamic Web TWAIN
1313

14-
* <a href="https://www.dynamsoft.com/Downloads/WebTWAIN_Download.aspx" target="_blank">Official installer</a>
14+
* <a href="https://www.dynamsoft.com/web-twain/downloads/" target="_blank">Official installer</a>
1515

1616
> This official package is meant for developers to evaluate the SDK. When the package is installed, you get all the resource files, documentation, and samples. A 30-day free trial is included when evaluating our SDK.
1717
@@ -25,11 +25,11 @@ description: Dynamic Web TWAIN SDK Documentation Resources Page
2525
2626
## Sample code
2727

28-
* <a href="https://www.dynamsoft.com/Downloads/WebTWAIN-Sample-Download.aspx" target="_blank">Official samples</a>
28+
* <a href="https://www.dynamsoft.com/web-twain/resources/code-gallery/" target="_blank">Official samples</a>
2929

3030
> We have many prebuilt samples to demonstrate common user scenarios. All samples contain the resource files required in your application. If a sample is hosted on the Dynamsoft website (not Github), then the sample comes with a 30-day free trial license as well. Otherwise, you can [get a trial license](#how-do-i-get-a-trial-license).
3131
32-
* <a href="https://github.com/dynamsoft-dwt" target="_blank">Github repo</a>
32+
* <a href="https://github.com/dynamsoft/web-twain-samples" target="_blank">Github repo</a>
3333

3434
> In our repository, we've shared many samples and other projects related to `Dynamic Web TWAIN` . Some of which may be experimental. To try out these samples, a [trial license](#how-do-i-get-a-trial-license) is required.
3535
@@ -39,11 +39,11 @@ Please visit our <a href="https://www.dynamsoft.com/customer/license/trialLicens
3939

4040
## Online Demo
4141

42-
* <a href="https://demo.dynamsoft.com/dwt/online_demo_scan.aspx" target="_blank">Official Demo - See Dynamic Web TWAIN in action</a>
42+
* <a href="https://demo.dynamsoft.com/web-twain/" target="_blank">Official Demo - See Dynamic Web TWAIN in action</a>
4343

4444
## Useful Links
4545

46-
* <a href="https://www.dynamsoft.com/Secure/imaging-web-application-buyit.aspx#" target="_blank">Price / Online Store</a>
46+
* <a href="https://www.dynamsoft.com/store/dynamic-web-twain/" target="_blank">Price / Online Store</a>
4747
* <a href="https://www.youtube.com/user/Dynamsoft" target="_blank">Online Videos</a>
4848

4949
## Blogs

_articles/faq/dwt-with-annotation.md

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ layout: default-layout
33
noTitleIndex: true
44
needAutoGenerateSidebar: true
55
title: Dynamic Web TWAIN with Annotations
6-
keywords: Dynamic Web TWAIN, Annotation
6+
keywords: Dynamic Web TWAIN, Annotation, Dynamsoft Document Viewer, DWT, DDV
77
breadcrumbText: Dynamic Web TWAIN with Annotations – Hello World
88
description: Dynamic Web TWAIN with Annotations – Hello World
99
---
1010

1111
# Dynamic Web TWAIN with Annotations – Hello World
1212

13-
The Dynamic Web TWAIN library (DWT) is a software development kit (SDK) specifically designed to integrate efficient document scanning workflows into various web applications. The Dynamsoft Document Viewer (DDV) is a versatile web document viewer with support for document annotations. In this guide, we explain how to use DDV in place of the built-in DWT viewer to enable annotations and provide a superior viewer experience.
13+
Dynamsoft's **Dynamic Web TWAIN (DWT)** is a software development kit (SDK) designed to integrate efficient document scanning workflows into web applications. **Dynamsoft Document Viewer (DDV)** is a versatile web document viewer with support for document annotations. In this guide, we explain how to **use DDV in place of DWT's built-in viewer** to enable **annotations** and provide a superior viewer experience.
14+
15+
In this sample, we create a **headless** DWT instance to scan images, and then pass the result to DDV to view, edit, annotate, etc. We then use DWT to save the result - **along with any edits and annotations** - to a file, or upload to the server.
1416

1517
![Flow chart for Dynamic Web TWAIN with Annotations – Hello World](/assets/imgs/dwt-with-ddv.jpg)
1618

@@ -20,7 +22,7 @@ The Dynamic Web TWAIN library (DWT) is a software development kit (SDK) specific
2022

2123
Use the SDK by including the packages below:
2224
- Dynamic Web TWAIN: provides scanning, saving, and uploading functionalities.
23-
- Dynamsoft Document Viewer: provides improved document viewer and annotation functionalities
25+
- Dynamsoft Document Viewer: provides improved document viewer and annotation functionalities.
2426

2527
### 1.1 Deliver Dependencies via CDN
2628

@@ -30,20 +32,20 @@ Deliver the SDK dependencies with either the [jsDelivr](https://jsdelivr.com/) o
3032

3133
```html
3234
<!--Dynamic Web TWAIN-->
33-
<script src="https://cdn.jsdelivr.net/npm/dwt@latest/dist/dynamsoft.webtwain.min.js"></script>
35+
<script src="https://cdn.jsdelivr.net/npm/dwt@19.1.0/dist/dynamsoft.webtwain.min.js"></script>
3436
<!--Dynamsoft Document Viewer-->
35-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@latest/dist/ddv.js"></script>
36-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@latest/dist/ddv.css">
37+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@3.0.0/dist/ddv.js"></script>
38+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@3.0.0/dist/ddv.css">
3739
```
3840

3941
- UNPKG
4042

4143
```html
4244
<!--Dynamic Web TWAIN-->
43-
<script src="https://unpkg.com/dwt@latest/dist/dynamsoft.webtwain.min.js"></script>
45+
<script src="https://unpkg.com/dwt@19.1.0/dist/dynamsoft.webtwain.min.js"></script>
4446
<!--Dynamsoft Document Viewer-->
45-
<script src="https://unpkg.com/dynamsoft-document-viewer@latest/dist/ddv.js"></script>
46-
<link rel="stylesheet" href="https://unpkg.com/dynamsoft-document-viewer@latest/dist/ddv.css">
47+
<script src="https://unpkg.com/dynamsoft-document-viewer@3.0.0/dist/ddv.js"></script>
48+
<link rel="stylesheet" href="https://unpkg.com/dynamsoft-document-viewer@3.0.0/dist/ddv.css">
4749
```
4850

4951
## 2. Define HTML Elements
@@ -60,7 +62,7 @@ Define the following elements:
6062

6163
```html
6264
<input type="button" value="Scan" onclick="AcquireImage();" />
63-
<input type="button" value="Save PDF" onclick="SavePDFs();" />
65+
<input type="button" value="Save PDF" onclick="SavePDF();" />
6466
<input type="button" value="Upload" onclick="Upload();" />
6567
```
6668

@@ -73,20 +75,17 @@ Define the following elements:
7375
// Public trial license which is valid for 24 hours
7476
// You can request a 30-day trial key from https://www.dynamsoft.com/customer/license/trialLicense/?product=dwtddv
7577
Dynamsoft.DDV.Core.license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
76-
Dynamsoft.DDV.Core.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@latest/dist/engine";
78+
Dynamsoft.DDV.Core.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@3.0.0/dist/engine";
7779
await Dynamsoft.DDV.Core.init();
7880
```
7981

8082
### 3.2 Create the Edit Viewer
8183

8284
```javascript
83-
// Enable image filtering
84-
Dynamsoft.DDV.setProcessingHandler("imageFilter", new Dynamsoft.DDV.ImageFilter());
8585
// Create a Dynamsoft Document Viewer Edit Viewer to display and edit documents scanned with Dynamic Web TWAIN
8686
let editViewer;
8787
editViewer = new Dynamsoft.DDV.EditViewer({
8888
container: "container",
89-
uiConfig: Dynamsoft.DDV.getDefaultUiConfig("editViewer", {includeAnnotationSet: true}),
9089
});
9190

9291
// Create a Dynamsoft Document Viewer document to contain and display images scanned by Dynamic Web TWAIN
@@ -105,10 +104,9 @@ Links to related documentation:
105104
- [`Edit Viewer`](https://www.dynamsoft.com/document-viewer/docs/features/viewers/editviewer.html)
106105
- [`How to configure your desired uiconfig`](https://www.dynamsoft.com/document-viewer/docs/ui/customize/index.html)
107106

108-
Links to API Reference:
107+
API Reference
109108

110-
- Dynamsoft Document Viewer:
111-
- [`setProcessingHandler()`](https://www.dynamsoft.com/document-viewer/docs/api/namespace/ddv.html#static-setprocessinghandler)
109+
- Dynamsoft Document Viewer:
112110
- [`Dynamsoft.DDV.EditViewer`](https://www.dynamsoft.com/document-viewer/docs/api/class/editviewer.html#editviewer)
113111
- [`createDocument()`](https://www.dynamsoft.com/document-viewer/docs/api/class/documentmanager.html#createdocument)
114112
- [`openDocument()`](https://www.dynamsoft.com/document-viewer/docs/api/class/editviewer.html#opendocument)
@@ -120,7 +118,7 @@ Links to API Reference:
120118
// You can request a 30-day trial key from https://www.dynamsoft.com/customer/license/trialLicense/?product=dwtddv
121119
Dynamsoft.DWT.ProductKey = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
122120
Dynamsoft.DWT.UseDefaultViewer = false;
123-
Dynamsoft.DWT.ResourcesPath = "https://cdn.jsdelivr.net/npm/dwt@latest/dist";
121+
Dynamsoft.DWT.ResourcesPath = "https://cdn.jsdelivr.net/npm/dwt@19.1.0/dist";
124122
// You need to set the service installer location here since the installer's size exceeds jsdelivr's limit. You'd better host the installers in your own environment.
125123
Dynamsoft.DWT.ServiceInstallerLocation = 'https://download2.dynamsoft.com/Demo/DWT/Resources/dist/';
126124

@@ -136,17 +134,17 @@ Dynamsoft.DWT.CreateDWTObjectEx({
136134
);
137135
```
138136

139-
Links to API Reference:
137+
API Reference
140138
- Dynamic Web TWAIN:
141139
- [`CreateDWTObjectEx()`](/_articles/info/api/Dynamsoft_WebTwainEnv.md#createdwtobjectex)
142140

143141
## 4. Use SDK Features
144142

145143
### 4.1 Add Simple Scanning Functionality
146144

147-
Use the Dynamic Web TWAIN instance for scanning. After scan completion, import the scanned data into DDV for viewing, editing, and annotating.
145+
Use the Dynamic Web TWAIN instance for scanning. Upon scan completion, import the scanned data into DDV for viewing, editing, and annotating.
148146

149-
#### 4.1.1 Register the OnPostTransferAsync Event
147+
#### 4.1.1 Register the `OnPostTransferAsync` Event
150148

151149
```javascript
152150
//Register the OnPostTransferAsync event in the success callback function of CreateDWTObjectEx.
@@ -181,7 +179,7 @@ function Dynamsoft_OnPostTransferAsync(outputInfo){
181179
}
182180
```
183181

184-
Links to API Reference:
182+
API Reference
185183

186184
- Dynamic Web TWAIN:
187185
- [`OnPostTransferAsync`](/_articles/info/api/WebTwain_Acquire.md#onposttransferasync)
@@ -206,20 +204,20 @@ function AcquireImage() {
206204
}
207205
```
208206

209-
Links to API Reference:
207+
API Reference
210208
- Dynamic Web TWAIN:
211209
- [`SelectSourceAsync()`](/_articles/info/api/WebTwain_Acquire.md#selectsourceasync)
212210
- [`AcquireImageAsync()`](/_articles/info/api/WebTwain_Acquire.md#acquireimageasync)
213211

214-
### 4.2 Add PDF Saving to Local Functionality
212+
### 4.2 Add PDF Saving to Local Functionality
215213

216-
Use the Dynamsoft Document Viewer saveToPdf API to convert the scanned document to a PDF Blob, then use the Dynamic Web TWAIN saveBlob API to export the document to local as a PDF.
214+
Use `saveToPdf()` from **DDV** to convert the scanned document to a PDF Blob, then use `saveBlob` from **DWT** to export the document to local as a PDF.
217215

218216
```javascript
219217
const pdfSettings = {
220218
saveAnnotation: "annotation"
221219
};
222-
function SavePDFs(){
220+
function SavePDF(){
223221
editViewer.currentDocument.saveToPdf(pdfSettings).then(function(blob){
224222
DWObject.IfShowFileDialog = true;
225223
DWObject.saveBlob("WebTWAINImage.pdf", blob).then(function () {
@@ -231,7 +229,7 @@ function SavePDFs(){
231229
}
232230
```
233231

234-
Links to API Reference:
232+
API Reference
235233
- Dynamic Web TWAIN:
236234
- [`IfShowFileDialog`](/_articles/info/api/WebTwain_IO.md#ifshowfiledialog)
237235
- [`saveBlob()`](/_articles/info/api/WebTwain_IO.md#saveblob)
@@ -240,7 +238,7 @@ Links to API Reference:
240238

241239
### 4.3 Add Server Upload Functionality
242240

243-
Use the Dynamsoft Document Viewer saveToPdf API to convert the scanned document to a PDF Blob, then use the Dynamic Web TWAIN httpUploadBlob API to upload the document to the server as a PDF.
241+
Use the `saveToPdf()` API from **DDV** to convert the scanned document to a PDF Blob, then use the `httpUploadBlob()` API from **DWT** to upload the document to the server as a PDF.
244242
```javascript
245243
// Can be discarded if already defined previously
246244
const pdfSettings = {
@@ -266,7 +264,7 @@ function Upload(){
266264
Links to related documentation:
267265
- [`Uploading Images to the Server`](https://www.dynamsoft.com/web-twain/docs/getstarted/uploading.html)
268266

269-
Links to API Reference:
267+
API Reference
270268
- Dynamic Web TWAIN:
271269
- [`httpUploadBlob()`](/_articles/info/api/WebTwain_IO.md#httpuploadblob)
272270
- Dynamsoft Document Viewer:
@@ -279,14 +277,14 @@ Links to API Reference:
279277
<html>
280278
<head>
281279
<title>HelloWorld</title>
282-
<script src=" https://cdn.jsdelivr.net/npm/dwt@latest/dist/dynamsoft.webtwain.min.js"></script>
283-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@latest/dist/ddv.js"></script>
284-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@latest/dist/ddv.css ">
280+
<script src=" https://cdn.jsdelivr.net/npm/dwt@19.1.0/dist/dynamsoft.webtwain.min.js"></script>
281+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@3.0.0/dist/ddv.js"></script>
282+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@3.0.0/dist/ddv.css">
285283
</head>
286284
<body>
287-
<input type="button" value="Scan" onclick="AcquireImage();" />
288-
<input type="button" value="Save PDF" onclick="SavePDFs();" />
289-
<input type="button" value="Upload" onclick="Upload();" /> <br/>
285+
<button onclick="AcquireImage();">Scan</button>
286+
<button onclick="SavePDF();">Save PDF</button>
287+
<button onclick="Upload();">Upload</button>
290288
<div id="container" style="height:580px; width: 1000px;"></div>
291289
</body>
292290
<script type="text/javascript">
@@ -297,15 +295,12 @@ let DWObject, editViewer, ddvDoc;
297295
// You can request a 30-day trial key from https://www.dynamsoft.com/customer/license/trialLicense/?product=dwtddv
298296
let license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
299297
Dynamsoft.DDV.Core.license = license;
300-
Dynamsoft.DDV.Core.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@latest/dist/engine";
298+
Dynamsoft.DDV.Core.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@3.0.0/dist/engine";
301299
await Dynamsoft.DDV.Core.init();
302300
303-
// Enable image filtering
304-
Dynamsoft.DDV.setProcessingHandler("imageFilter", new Dynamsoft.DDV.ImageFilter());
305301
// Create a Dynamsoft Document Viewer Edit Viewer to display and edit documents scanned with Dynamic Web TWAIN
306302
editViewer = new Dynamsoft.DDV.EditViewer({
307-
container: "container",
308-
uiConfig: Dynamsoft.DDV.getDefaultUiConfig("editViewer", {includeAnnotationSet: true})
303+
container: "container"
309304
});
310305
311306
// Create a Dynamsoft Document Viewer document to contain and display images scanned by Dynamic Web TWAIN
@@ -319,7 +314,7 @@ let DWObject, editViewer, ddvDoc;
319314
// Create Dynamic Web TWAIN object
320315
Dynamsoft.DWT.ProductKey = license;
321316
Dynamsoft.DWT.UseDefaultViewer = false;
322-
Dynamsoft.DWT.ResourcesPath = "https://cdn.jsdelivr.net/npm/dwt@latest/dist";
317+
Dynamsoft.DWT.ResourcesPath = "https://cdn.jsdelivr.net/npm/dwt@19.1.0/dist";
323318
// You need to set the service installer location here since the installer's size exceeds jsdelivr's limit. You'd better host the installers in your own environment.
324319
Dynamsoft.DWT.ServiceInstallerLocation = 'https://download2.dynamsoft.com/Demo/DWT/Resources/dist/';
325320
@@ -370,7 +365,7 @@ const pdfSettings = {
370365
saveAnnotation: "annotation"
371366
};
372367
373-
function SavePDFs(){
368+
function SavePDF(){
374369
editViewer.currentDocument.saveToPdf(pdfSettings).then(function(blob){
375370
DWObject.IfShowFileDialog = true;
376371
DWObject.saveBlob("WebTWAINImage.pdf", blob).then(function () {
@@ -408,4 +403,4 @@ function Upload(){
408403
## Further Reading
409404

410405
- [`Use the API to edit images within the control`](https://www.dynamsoft.com/document-viewer/docs/features/viewers/editviewer.html#edit-pages)
411-
- [`Use the API to delete or switch images within the control`](https://www.dynamsoft.com/document-viewer/docs/api/interface/idocument/index.html#members)
406+
- [`Use the API to delete or switch images within the control`](https://www.dynamsoft.com/document-viewer/docs/api/interface/idocument/index.html#members)

0 commit comments

Comments
 (0)