Dynamic Web TWAIN: How to show all scanners in a drop down list

Scenario: You would like to display all of the devices sources (scanners) in a drop-down menu

Solution: Add the following code segments to your scan page:

In the <body> tags:

&amp;lt;select size="1" id="source" style="position: relative; width: 220px;"&amp;gt;&amp;lt;/select&amp;gt;

In Dynamsoft_OnReady():

if (DWObject) {
                var count = DWObject.SourceCount; // Populate how many sources are installed in the system
                for (var i = 0; i &amp;lt; count; i++)
                    document.getElementById("source").options.add(new Option(DWObject.GetSourceNameItems(i), i));  // Add the sources in a drop-down list

In AcquireImage():

// Get the source from the drop down.
Is this page helpful?

Leave a Reply