Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Dev Center
Table of contents

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
    • Version 17.2.1
    • Version 17.1.1
    • Version 17.0
    • Version 16.2
    • Version 16.1.1
    Change +
    © 2003–2022 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support