Dynamic Web TWAIN-- only part of how scanned images

In some cases, you may want to scan only part of the information of the picture. At this time, Dynamic Web TWAIN will be able to fulfill the demand.

Dynamic Web TWAIN provides an interface called SetImageLayout , you can determine the portion of the image to be scanned by this method.

Sample code:

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();
    }
}

If you know the page size such as A4, USLEGAL, etc., may be used PageSize this property.

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();
    }
}

 

Released two original articles · won praise 4 · Views 4054

Guess you like

Origin blog.csdn.net/weixin_42320186/article/details/88912521