[]
        
(Showing Draft Content)

Load Image

DsImageViewer lets you open an image file in two ways, either through user interface or through code. To open an image file in the DsImageViewer control, you can use the Open document button (open-folder.png) of the toolbar. To open a file programmatically, you can use open method of the DsImageViewer class and pass string url to the image document or binary data. However, to load an image saved in binary format, you need to specify the imageFormat option as well. You can also use this option to fetch format type of the active image.

function loadImageViewer() {
    // intialize image viewer
    var viewer = new DsImageViewer("#imageviewer");

    // load an image
    viewer.open("https://i.imgur.com/tl0ZsW7.jpeg");

    // open TIFF image
    viewer.open("Multi_page24bpp.tif", { imageFormat: 3 });
}

The table below mentions about supported image formats and corresponding value of the imageFormat option.

Image Format

Value of imageFormat option

JPEG

1

PNG

2

TIFF

3

GIF

4

BMP

5

ICO

6

SVG

7

WebP

8

Unknown

0