Add/Remove Additional Dynamic Web TWAIN object(s)

NOTE: What is discussed here works only for the HTML5 editions of Dynamic Web TWAIN.

To add/remove an additional Dynamic Web TWAIN object, you can use the following methods.

Dynamsoft.WebTwainEnv.CreateDWTObject(id, OnSuccessCallback, OnFailureCallback)
Dynamsoft.WebTwainEnv.DeleteDWTObject(id).

Add a Dynamic Web TWAIN object at runtime

  1. Create a new DIV element as the placeholder for this object.

     <div id="dwtcontrolContainer2"></div>
    
  2. Use the method Dynamsoft.WebTwainEnv.CreateDWTObject(id, OnSuccessCallback, OnFailureCallback) to create and initialize the Dynamic Web TWAIN object that will be embedded in the div with id dwtcontrolContainer2.

     var DWObject2;
     Dynamsoft.WebTwainEnv.CreateDWTObject(
         "dwtcontrolContainer2",
         function (newDWObject) { DWObject2 = newDWObject; },
         function (errorString) { alert(errorString); }
     );
    

    NOTE: If the div element with id dwtcontrolContainer2 already exists in Dynamsoft.WebTwainEnv.Containers, you will get the following error

    Duplicate ID detected for creating Dynamic Web TWAIN objects, please check and modify.

    When this happens, please check if you’ve set dwtcontrolContainer2 in Dynamsoft.WebTwainEnv.Containers in dynamsoft.webtwain.config.js

  3. You can now use the new Dynamic Web TWAIN object.

     DWObject2.Width = 580;
     DWObject2.Height = 600;
     DWObject2.SelectSource();
     DWObject2.AcquireImage();
    

Remove a Dynamic Web TWAIN object at runtime

To remove a Dynamic Web TWAIN object from the web page. Just call the method Dynamsoft.WebTwainEnv.DeleteDWTObject(id) with id specifying the container id. For example

Dynamsoft.WebTwainEnv.DeleteDWTObject("dwtcontrolContainer2");

NOTE:

Dynamsoft.WebTwainEnv.Unload() can’t release the Dynamic Web TWAIN objects generated by the method Dynamsoft.WebTwainEnv.CreateDWTObject(). You can only use the method Dynamsoft.WebTwainEnv.DeleteDWTObject(id) to release that object.

results matching ""

    No results matching ""

    results matching ""

      No results matching ""