Dev Center
Table of contents

Thanks for Downloading Dynamic Web TWAIN 30-Day Trial!

Your download will start shortly. If your download does not begin, click here to retry.

Capture/Image Source

How can I get a list of supported resolution/DPI values from the document scanner?

You can use capability negotiation to get all the resolutions supported by the scanner.

Steps:

  • Step-1: Use getCapabilities to get all capabilities of the current data source,
DWObject.OpenSource();
DWObject.getCapabilities(
  function () {
    console.log(arguments);
  },
  function (error) {
    console.log(error);
  }
);

and then find the capability corresponding to the resolution. Normally, it is called ICAP_XRESOLUTION.

Capability Resolution

  • Step-2: Call the following code to get all the resolutions supported by the scanner.
DWObject.OpenSource();
DWObject.getCapabilities(
  function (result) {
    for (var i = 0; i < result.length; i++) {
      if (result[i].capability.value === Dynamsoft.DWT.EnumDWT_Cap.ICAP_XRESOLUTION) {
        if (result[i].conType.label === 'TWON_ENUMERATION') { // If the capability's Vaule Type is Enumeration
            dpi = result[i].values;
            console.log(dpi); // The list of supported resolution.
        } else if (result[i].conType.label === 'TWON_RANGE') { // If the capability's Vaule Type is Range
            max = result[i].maxValue;
            min = result[i].minValue;
            step = result[i].stepSize;

            console.log("maxValue: " + max); // The maximum value for the resolution.
            console.log("minValue: " + min); // The minimum value for the resolution.
            console.log("stepSize: " + step); // The step size for the resolution.
        } else {
            console.log("Please contact Dynamsoft for help.");
        }
      }
    }   
  },
  function (error) {
    console.log(error);
  }
);

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest Version (18.4)
    • Version 18.3
    • Version 18.1
    • Version 18.0
    • Version 17.3
    • Version 17.2.1
    • Version 17.1.1
    • Version 17.0
    • Version 16.2
    • Version 16.1.1
    Change +