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.

Image Viewer

Can the size of the image viewer auto resize when the browser window size changes?

Scenario When using Dynamic Web TWAIN in different environments, it may be necessary to change the size of the viewer within the window automatically.

Steps This can be done in two different ways

  1. Set the viewer size when the page is opened based upon the size of the window
  2. Change the viewer size when the window size is adjusted based on the new size of the window

For option 1: You may change the container size based on the window size by setting the following in your javascript file (before any other Dynamsoft-related operations):

Dynamsoft.DWT.Containers = [
    ContainerId: "dwtcontrolContainer",
    Width: window.innerWidth,
    Height: window.innerHeight,

and in dynamsoft.webtwain.config.js file set:

Dynamsoft.DWT.Containers = [];

Note: window.innerWidth and window.innerHeight do not work in IE. You can replace it with document.documentElement.clientWidth and document.documentElement.clientHeight.

For option 2:

Write your own function to calculate the Container’s width and height according to the browser’s size. Then, assign the values to our API’s Height & Width. Finally, use the event resize to trigger the function.

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest Version (18.5)
    • 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 +