Resources Base
Table of contents

Development

How do you use Capability Negotiation?

This feature is only available for TWAIN scanners.

A: Capability Negotiation is the way a TWAIN application communicates with a TWAIN source. This is how Dynamic Web TWAIN communicates with a scanner. The process looks something like this:

  • [Dynamic Web TWAIN] Are you capable of ***?
  • [Scanner] Yes, and here is what I can do…
  • [Dynamic Web TWAIN] Great, here is what I want done…
  • [Scanner] Consider it done

Dynamic Web TWAIN provides two methods, getCapabilities() and setCapabilities() , for negotiation. The following shows how to ask for supported page sizes and set it to A4 using Capability Negotiation.

Ask for supported sizes
DWObject.getCapabilities(function(result) {
    for (var i = 0; i < result.length; i++) {
        if (result[i].capability.value === Dynamsoft.DWT.EnumDWT_Cap.ICAP_SUPPORTEDSIZES)
            sizes = result[i].values;
    }
    console.log(sizes);
}, function(error) {
    console.log(error);
});
Set page size to A4
DWObject.setCapabilities({
        exception: "ignore",
        capabilities: [{
            capability: Dynamsoft.DWT.EnumDWT_Cap.ICAP_SUPPORTEDSIZES,
            curValue: 1, // 1 means 'A4' in our case
            exception: "fail"
        }]
    },
    function(result) {
        console.log(result)
    },
    function(error) {
        console.log(error);
    }
);

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest Version
    • Version 17.0
    • Version 16.2
    • Version 16.1.1
    Change +
    © 2003–2021 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support