Skip to main content

PageVisibleArea

Version: 2.0

cete.dynamicpdf.viewer.pagevisiblearea

PageVisibleArea​

  • Namespace: ceTe.DynamicPDF.Viewer
  • Assemblies: ceTe.DynamicPDF.Viewer.40.x64.dll, ceTe.DynamicPDF.Viewer.40.x86.dll

Provides the details of visible area of a page.

public class PageVisibleArea
Public Class PageVisibleArea

Inheritance: Object → PageVisibleArea

Licensing​

This class is a DynamicPDF Viewer feature. The following license is required for non-evaluation usage:

  • DynamicPDF Viewer for .NET

Examples​

The following example will show how we can get the array of PageVisibleArea for a view.

Imports System
Imports System.Windows.Forms
Imports ceTe.DynamicPDF.Viewer

Public Class Form1
Inherits System.Windows.Forms.Form

Private MyPdfViewer As PdfViewer

Sub New()
InitializeComponent()
End Sub

Private Sub InitializeComponent()
Me.MyPdfViewer = New PdfViewer()
Me.Controls.Add(MyPdfViewer)
End Sub

Shared Sub Main()
Application.Run(New Form1())
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
' Load and Open the document in Viewer.
Dim MyDocument As New PdfDocument("C:\MyDocument.pdf")
MyPdfViewer.Open(MyDocument)

'Get a view to calculate visible page area
Dim MyCurrentView As ceTe.DynamicPDF.Viewer.View = MyPdfViewer.GetCurrentView()

'Get the array of pages with their visible area
Dim MyVisibleAreaArray As PageVisibleArea() = MyPdfViewer.GetPageVisibleArea(MyCurrentView)

'Get the details of visible page area
Dim pageNumber As Integer = MyVisibleAreaArray(0).PageNumber
Dim left As Single = MyVisibleAreaArray(0).Left
Dim top As Single = MyVisibleAreaArray(0).Top
Dim right As Single = MyVisibleAreaArray(0).Right
Dim bottom As Single = MyVisibleAreaArray(0).Bottom

End Sub

End Class
using System;
using System.Windows.Forms;
using ceTe.DynamicPDF.Viewer;

namespace DynamicPDFViewerDemo
{
public class Form1 : Form
{
private ceTe.DynamicPDF.Viewer.PdfViewer pdfViewer;

public Form1()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);
}

private void InitializeComponent()
{
this.pdfViewer = new PdfViewer();
this.Controls.Add(pdfViewer);
}

[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, EventArgs e)
{
// Load and Open the document in Viewer.
PdfDocument document = new PdfDocument(@"C:\MyDocument.pdf");
pdfViewer.Open(document);

// Get a view to calculate visible page area
ceTe.DynamicPDF.Viewer.View currentView = pdfViewer.GetCurrentView();

// Get the array of pages with their visible area
PageVisibleArea[] visibleAreaArray = pdfViewer.GetPageVisibleArea(currentView);

// Get the details of visible page area
int pageNumber = visibleAreaArray[0].PageNumber;
float left = visibleAreaArray[0].Left;
float top = visibleAreaArray[0].Top;
float right = visibleAreaArray[0].Right;
float bottom = visibleAreaArray[0].Bottom;
}
}
}

Properties​

Bottom​

Gets the bottom value of the page.

public float Bottom { get; }
Public ReadOnly Property Bottom As Single

Property Value​

Single

Remarks​

This value ranges from from value of displayed proportion to '1' and is equal to the portion of the page lying inside the bottom edge of the display.If the full page is inside the bottom edge then bottom value will be '0'. We can get the percentage of page on display vertically then calculation is (Bottom - Top) * 100 .

Left​

Gets the left value of the page.

public float Left { get; }
Public ReadOnly Property Left As Single

Property Value​

Single

Remarks​

This value ranges from '0' to '1' and is equal to the portion of the page lying outside the left edge of the display.If the page is inside the display then left value will be '0'. We can get the percentage of page on display horizontally then calculation is (Right - Left) * 100 .

PageNumber​

Gets the page number.

public int PageNumber { get; }
Public Property PageNumber As Int32

Property Value​

Int32

PixelBottom​

Gets the bottom display end position of the page in pixels.

public float PixelBottom { get; }
Public ReadOnly Property PixelBottom As Single

Property Value​

Single

PixelLeft​

Gets the left display start position of the page in pixels.

public float PixelLeft { get; }
Public ReadOnly Property PixelLeft As Single

Property Value​

Single

PixelRight​

Gets the right display end position of the page in pixels.

public float PixelRight { get; }
Public ReadOnly Property PixelRight As Single

Property Value​

Single

PixelTop​

Gets the top display start position of the page in pixels.

public float PixelTop { get; }
Public ReadOnly Property PixelTop As Single

Property Value​

Single

Gets the right value of the page.

public float Right { get; }
Public ReadOnly Property Right As Single

Property Value​

Single

Remarks​

This value ranges from '0' to '1' and is equal to the portion of the page lying inside the Right edge of the display.If the full page is inside the right edge then right value will be '1'. We can get the percentage of page on display then calculation is (Right - Left) * 100 .

Top​

Gets the top value of the page.

public float Top { get; }
Public ReadOnly Property Top As Single

Property Value​

Single

Remarks​

This value ranges from value of displayed proportion to '1' and is equal to the portion of the page lying outside the top edge of the display.If the page is inside the display then top value will be '0'. We can get the percentage of page on display vertically then calculation is (Bottom - Top) * 100 .

Methods​

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

See Also​

ceTe.DynamicPDF.Viewer