[]
        
(Showing Draft Content)

PagePointer

The PagePointerEvent in FlexViewer enables applications to detect pointer interactions on a rendered document page. The event returns pointer coordinates relative to the document page (document-space coordinates) instead of screen pixels, enabling accurate positioning for scenarios such as annotations, hit testing, and custom interactive behavior.

This feature is supported for all document sources supported by FlexViewer, including FlexReport, PDF, and SSRS documents.

Get Page Coordinates

FlexViewer exposes the PagePointerEvent through the C1FlexViewerPane class. The event is raised when the user interacts with a rendered document page using the mouse.

The event provides the X and Y coordinates of the pointer relative to the document page, based on the document's MeasurementUnits.

PagePointerEvent is available through the C1FlexViewerPane object, which can be accessed using the C1FlexViewer.Pane property.

PagePointerEventArgs

The PagePointerEventArgs class provides information about the pointer interaction, including pointer position, page information, and mouse input details.

Property

Type

Description

Page

C1Page

Represents the document page where the interaction occurred.

HitTestInfo

HitTestInfo

Provides information about the specific location within the page.

X

double

Gets the X-coordinate relative to the page, expressed in the document's MeasurementUnits.

Y

double

Gets the Y-coordinate relative to the page, expressed in the document's MeasurementUnits.

Button

MouseButtons

Indicates the mouse button that triggered the event.

Clicks

int

Gets the number of mouse clicks associated with the event.

DeltaSign

int

Indicates the mouse wheel direction: -1, 0, or 1.

Use PagePointerEvent

To retrieve page coordinates, subscribe to the PagePointerEvent on the viewer pane. The returned X and Y values are expressed in the document's measurement units and can be converted to other unit types by using the C1.Document.Unit.Convert method.

The following example demonstrates how to retrieve the coordinates of a single left mouse click and convert the values to millimeters.

c1FlexViewer1.Pane.PagePointerEvent += (object sender, PagePointerEventArgs e) =>
{
    if (e.Button == MouseButtons.Left && e.Clicks == 1)
    {
        // e.X and e.Y are in the document's MeasurementUnits.
        // Convert to millimetres or any other unit as needed.
        var units = c1FlexViewer1.DocumentSource.Document.MeasurementUnits;
        double xMm = C1.Document.Unit.Convert(e.X, units, C1.Document.UnitTypeEnum.Mm);
        double yMm = C1.Document.Unit.Convert(e.Y, units, C1.Document.UnitTypeEnum.Mm);
    }
};