currentPageNumber Property (DocumentViewer)

Summary

Current page number.

Syntax

JavaScript Syntax
Object.defineProperty(DocumentViewer.prototype, 'currentPageNumber', 
	get: function() 
) 
TypeScript Syntax
currentPageNumber: number; // read-only

Property Value

The 1-based number of the current page.

Remarks

The CurrentPageNumber is the page with the largest area currently visible in the View.

This is obtained by calling View.ImageViewer.GetLargestVisibleItemIndex.

The value changes when the user scrolls the view or zooms in or out and should not be saved. Instead, use CurrentPageNumber every time the "largest visible page" is needed. For example, the application can have a "Find text in this page" or "Find text in the whole document" operations. When the user runs the "Find text in this page", they are referring to the largest page in the viewer, and the application should call CurrentPageNumber to get this value when the action is invoked.

Example

Start with the example created in DocumentViewer, remove all the code in the Example function and add the code below.

When the user clicks the Example button, We will intercept when the user changes the page number, show the current page in the label.

JavaScript Example
// Disable the example button, this should only run once 
var _this = this; 
$("#exampleButton").prop("disabled", true); 
this._documentViewer.operation.add(function(sender, e) { 
   if (e.operation == lt.Documents.UI.DocumentViewerOperation.gotoPage && e.isPostOperation) { 
      var pageNumber = _this._documentViewer.currentPageNumber; 
      $("#infoLabel").text("Current page number is " + pageNumber); 
   } 
}); 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Documents.UI Assembly
Click or drag to resize