ImageViewer Object

Summary

Represents a scrollable control that displays one or more raster or SVG images and provides optional interactive UI operations.

Syntax

JavaScript Syntax
function lt.Controls.ImageViewer 
	implements IDisposable 
TypeScript Syntax
class lt.Controls.ImageViewer() 
	implements IDisposable 

Remarks

The LEADTOOLS ImageViewer class represents a control that displays one or more images and provides optional interactive UI operations. It can be used in single item applications like MS-Paint or multiple item applications like Adobe Acrobat.

  1. LEADTOOLS Main Demo uses an Image Viewer instance in single layout mode to view the main image

  2. LEADTOOLS Document Viewer Demo uses an Image Viewer instance in vertical layout to view thumbnails of pages

  3. And another Image Viewer instance with in double layout to view the main content

The ImageViewer class provides the following features:

  • Single or multiple items each with its own image data, size, and optional additional transformation

  • Built-in support to load raster images, SVG images, and documents, including directly loading remote URLs

  • Extensible layout system with built-in support for single, vertical and horizontal layouts

  • Rich, fully customizable and extensible user-interface that provides rich interactive tools such as pan, zoom, magnify glass, rubber band, and many more

  • Supports user input from both mouse and touch

  • Fully customizable appearance and position

  • Auto and custom scroll modes

  • Owner draw rendering

  • Viewing options include infinite zooming with size modes (fit, fit page, etc.), rotation at any angle, flip, reverse, color inversion, and low level transformation

  • High level item operations for hit-testing and to automatically go to a specific item or page

  • Drag and drop between the image viewer and external sources such as the file system or other image viewers instances

  • Provides floater image and region of interest functionality

  • Resample and scale-to-gray display interpolation

Refer to the following topics for more in-depth information on each group of features:

Example

This example will create an ImageViewer, set the interactive mode to Pan/Zoom, and add an image to the viewer.

JavaScript Example
var _label; 
var _firstCall = true; 
 
var example = function () { 
   // Example code goes here 
} 
 
// Create a panel to the top 
var panel = document.createElement("div"); 
panel.style.width = "800"; 
panel.style.height = "800"; 
document.body.appendChild(panel); 
 
// Add an "Example" button to the panel 
var button = document.createElement("button"); 
button.textContent = "&example"; 
button.addEventListener("click", example); 
panel.appendChild(button); 
 
// Add a label to the panel 
_label = document.createElement("h5"); 
_label.style.width = "800"; 
_label.textContent = "Example..."; 
panel.appendChild(_label); 
 
// Create the image viewer taking the rest of the form 
var imageViewerDiv = document.createElement("div"); 
document.body.appendChild(imageViewerDiv); 
this._imageViewer = new lt.Controls.ImageViewer(new lt.Controls.ImageViewerCreateOptions(imageViewerDiv)); 
 
// Add Pan/Zoom interactive mode 
// Click and drag to pan, CTRL-Click and drag to zoom in and out 
this._imageViewer.defaultInteractiveMode = new lt.Controls.ImageViewerPanZoomInteractiveMode(); 
 
// Load an image into the viewer 
var imageUrl = "http://demo.leadtools.com/images/png/ocr1.png"; 
this._imageViewer.url = imageUrl; 
 
_firstCall = true; 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly