Dynamic Web TWAIN: How can I scan only a part of a picture?

You can use Dynamic Web TWAIN's SetImageLayout method to decide which part of the image you are going to scan.

If you know your page size like A4LETTER, USLEGAL, and etc., please use PageSize property.

Code (Javascript):

function scanImage() {
    var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
    if (DWObject) {
        DWObject.SelectSource();
        DWObject.OpenSource();
        DWObject.IfShowUI = false;
        DWObject.Unit = EnumDWT_UnitType.TWUN_INCHES;
        DWObject.SetImageLayout(0, 0, 5, 5);
        DWObject.AcquireImage();
    }
}

Or,

function scanImage() {
    var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
    if (DWObject) {
        DWObject.SelectSource();
        DWObject.OpenSource();
        DWObject.IfShowUI = false;
        DWObject.PageSize = EnumDWT_CapSupportedSizes.TWSS_USLEGAL;
        DWObject.AcquireImage();
    }
}
Is this page helpful?

Leave a Reply

Your email address will not be published.