0

如何在dwtcontrolContainerdiv 中调整扫描图像的大小?因为当我向下滚动屏幕时,所选区域永远不会跟随鼠标并选择鼠标单击上方的区域。

波纹管是我的AcquireImage功能:

function AcquireImage() {
            try {
                if (DWObject) {
                    var _obj = {};
                    _obj.IfShowUI = false;
                    _obj.PixelType = 0;
                    _obj.Resolution = 300;
                    _obj.IfFeederEnabled = true;
                    _obj.IfDuplexEnabled = false;
                    _obj.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
                    _obj.Brightness = 10000;
                    _obj.MaxImagesInBuffer = 3;
                    _obj.PageSize = 0;
                    _obj.Contrast = 1000;

                    DWObject.SelectSourceByIndex(document.getElementById("rdlScanner").selectedIndex);
                    DWObject.OpenSource();
                    DWObject.AcquireImage(_obj);
                    DWObject.SetViewMode(-1, -1);

                    DWObject.CurrentImageIndexInBuffer = 0;

                    updatePageInfo();
                }

            }
            catch (err) {
                alert("Error: " + err.message);
            }
        }

我发现http://developer.dynamsoft.com/dwt/dynamic-web-twain-how-to-resize-the-viewer-automatically但即使配置 .jsdynamsoft.webtwain.config.js也不起作用

4

1 回答 1

2

您的链接是关于如何更改查看器的大小,而不是图像大小。在这里,我将您的查看器大小更改为600x800

function AcquireImage() {
            try {
                if (DWObject) {
                    DWObject.Width = 600; // viewer width
                    DWObject.Height = 800; // viewer height
                    var _obj = {};
                    _obj.IfShowUI = false;
                    _obj.PixelType = 0;
                    _obj.Resolution = 300;
                    _obj.IfFeederEnabled = true;
                    _obj.IfDuplexEnabled = false;
                    _obj.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
                    _obj.Brightness = 10000;
                    _obj.MaxImagesInBuffer = 3;
                    _obj.PageSize = 0;
                    _obj.Contrast = 1000;

                    DWObject.SelectSourceByIndex(document.getElementById("rdlScanner").selectedIndex);
                    DWObject.OpenSource();
                    DWObject.AcquireImage(_obj);
                    DWObject.SetViewMode(-1, -1);

                    DWObject.CurrentImageIndexInBuffer = 0;

                    updatePageInfo();
                }

            }
            catch (err) {
                alert("Error: " + err.message);
            }
        }

如果要更改图像大小,请访问此链接:http: //developer.dynamsoft.com/dwt/changeimagesize

我创建了两个按钮来更改图像大小:

function small() {
        var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
        DWObject.ChangeImageSize(0, 300, 400, EnumDWT_InterpolationMethod.IM_NEARESTNEIGHBOUR);
    }
    function big() {
        var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
        DWObject.ChangeImageSize(0, 600, 800, EnumDWT_InterpolationMethod.IM_NEARESTNEIGHBOUR);
    }

在此处输入图像描述

于 2017-11-21T00:29:41.017 回答