@@ -52,18 +52,8 @@ permalink: /info/api/WebTwain_Viewer.html
5252/**
5353 * Create a Dynamsoft Viewer instance and bind it to the WebTwain instance.
5454 * @param element Specify an HTML element to create the viewer.
55- * @param documentTemplate Specify the document template.
5655 */
57- bind (element : HTMLDivElement , documentTemplate : DocumentViewerTemplate ) : void ;
58-
59- interface DocumentViewerTemplate {
60- getCustomElement(): CustomElement ; // Get CustomElement. Can display save & upload interface in CustomElement.
61- onAddDocumentFunc = function () {}
62- onExitFunc = function () {}
63- onSaveFunc = function () {} // Save button click event
64- onUploadFunc = function () {} // Upload button click event
65- onRemoveSelectedFunc = function () {} // Remove button click event
66- }
56+ bind (element : HTMLDivElement | HTMLElement ) : boolean ;
6757```
6858
6959** Example**
@@ -73,20 +63,15 @@ var DWObject, template;
7363Dynamsoft .DWT .CreateDWTObjectEx (
7464 {
7565 WebTwainId: " a" ,
76- UseLocalService: false ,
7766 },
7867 function (obj ) {
7968 DWObject = obj;
80- template = DWObject .Viewer .createTemplate (" documentScanner" );
81- DWObject .Viewer .bind (null , template); // full screen
82- DWObject .Viewer .show ();
83-
84- template .onExitFunc = function () {
85- DWObject .Viewer .show ();
86- console .error (" execute" );
87- // RemoveAllFile();
88- }
89- }, function (errorCode , errorString ) {
69+ template = DWObject .Viewer .getElementById (" dwtcontrolContainer_temp3" );
70+ DWObject .Viewer .width = 500 ;
71+ DWObject .Viewer .height = 600 ;
72+ DWObject .Viewer .show ();
73+ },
74+ function (errorCode , errorString ) {
9075 console .log (errorString);
9176 });
9277```
@@ -2433,96 +2418,6 @@ When set to true, the index in the upper left corner of the viewer will be selec
24332418
24342419---
24352420
2436- ## createTemplate
2437-
2438- ** Syntax**
2439-
2440- <div class =" sample-code-prefix template2 " ></div >
2441- > - v17.3
2442- > - v17.2.5
2443- >
2444- >
2445- ``` typescript
2446- /**
2447- * Create document scanner template.
2448- * @argument templateName Currently templateName only supports "documentScanner".
2449- * @argument documentConfiguration Configuration for the document object.
2450- */
2451- createTemplate (" templateName" , documentConfiguration ?: DocumentConfiguration ):DocumentViewerTemplate
2452- interface DocumentViewerTemplate {
2453- getCustomElement(): CustomElement ; // Get CustomElement. Can display save & upload interface in CustomElement.
2454- onAddDocumentFunc = function () {}
2455- onExitFunc = function () {}
2456- onSaveFunc = function () {} // Save button click event
2457- onUploadFunc = function () {} // Upload button click event
2458- onRemoveSelectedFunc = function () {} // Remove button click event
2459- }
2460- ```
2461- ``` typescript
2462- /**
2463- * Create document scanner template.
2464- * @argument templateName Currently templateName only supports "documentScanner".
2465- */
2466- createTemplate (" templateName" ):DocumentViewerTemplate
2467- interface DocumentViewerTemplate {
2468- getCustomElement(): CustomElement ; // Get CustomElement. Can display save & upload interface in CustomElement.
2469- onAddDocumentFunc = function () {}
2470- onExitFunc = function () {}
2471- onSaveFunc = function () {} // Save button click event
2472- onUploadFunc = function () {} // Upload button click event
2473- onRemoveSelectedFunc = function () {} // Remove button click event
2474- }
2475- ```
2476- ** Availability**
2477- <div class =" availability " >
2478- <table >
2479-
2480- <tr >
2481- <td align =" center " >ActiveX</td >
2482- <td align =" center " >H5(Windows)</td >
2483- <td align =" center " >H5(macOS/TWAIN)</td >
2484- <td align =" center " >H5(macOS/ICA)</td >
2485- <td align =" center " >H5(Linux)</td >
2486- </tr >
2487-
2488- <tr >
2489- <td align =" center " >not supported </td >
2490- <td align =" center " >v17.3+ </td >
2491- <td align =" center " >v17.3+ </td >
2492- <td align =" center " >v17.3+ </td >
2493- <td align =" center " >v17.3+ </td >
2494- </tr >
2495-
2496- </table >
2497- </div >
2498-
2499- ** Example**
2500-
2501- ``` javascript
2502- var DWObject, template;
2503- Dynamsoft .DWT .CreateDWTObjectEx (
2504- {
2505- WebTwainId: " a" ,
2506- UseLocalService: false ,
2507- },
2508- function (obj ) {
2509- DWObject = obj;
2510- template = DWObject .Viewer .createTemplate (" documentScanner" );
2511- DWObject .Viewer .bind (null , template); // full screen
2512- DWObject .Viewer .show ();
2513-
2514- template .onExitFunc = function () {
2515- DWObject .Viewer .show ();
2516- console .error (" execute" );
2517- // RemoveAllFile();
2518- }
2519- }, function (errorCode , errorString ) {
2520- console .log (errorString);
2521- });
2522- ```
2523-
2524- ---
2525-
25262421## updateCheckboxStyle
25272422
25282423** Syntax**
0 commit comments