Error processing SSI file
LEADTOOLS Leadtools.Documents.UI (Leadtools.Documents.UI assembly)

Show in webframe

CurrentPageNumber Property






Current page number.
Syntax
public virtual int CurrentPageNumber {get;}
'Declaration
 
Public Overridable ReadOnly Property CurrentPageNumber As Integer
'Usage
 
Dim instance As DocumentViewer
Dim value As Integer
 
value = instance.CurrentPageNumber
public:
virtual property int CurrentPageNumber {
   int get();
}

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.

Copy Code  
Imports Leadtools
Imports Leadtools.Controls
Imports Leadtools.Documents
Imports Leadtools.Documents.UI
Imports Leadtools.Codecs
Imports Leadtools.Caching
Imports Leadtools.Annotations.Core
Imports Leadtools.Forms.Ocr

' Disable the example button, this should only run once
exampleButton.Enabled = False
AddHandler _documentViewer.Operation,
   Sub(sender, e)
      If e.Operation = DocumentViewerOperation.GotoPage AndAlso e.IsPostOperation Then
         Dim pageNumber As Integer = _documentViewer.CurrentPageNumber
         Dim infoLabel As Control = Me.Controls.Find("infoLabel", True)(0)
         infoLabel.Text = "Current page number is " + pageNumber.ToString()
      End If
   End Sub
using Leadtools;
using Leadtools.Controls;
using Leadtools.Documents;
using Leadtools.Documents.UI;
using Leadtools.Codecs;
using Leadtools.Caching;
using Leadtools.Annotations.Core;
using Leadtools.Forms.Ocr;

// Disable the example button, this should only run once
exampleButton.Enabled = false;
_documentViewer.Operation += (sender, e) =>
{
   if (e.Operation == DocumentViewerOperation.GotoPage && e.IsPostOperation)
   {
      var pageNumber = _documentViewer.CurrentPageNumber;
      var infoLabel = this.Controls.Find("infoLabel", true)[0];
      infoLabel.Text = "Current page number is " + pageNumber;
   }
};
Requirements

Target Platforms

See Also

Reference

DocumentViewer Class
DocumentViewer Members

Error processing SSI file
Leadtools.Documents.UI requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features