[]
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.
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.
PagePointerEventis available through theC1FlexViewerPaneobject, which can be accessed using theC1FlexViewer.Paneproperty.
The PagePointerEventArgs class provides information about the pointer interaction, including pointer position, page information, and mouse input details.
Property | Type | Description |
|---|---|---|
|
| Represents the document page where the interaction occurred. |
|
| Provides information about the specific location within the page. |
|
| Gets the X-coordinate relative to the page, expressed in the document's |
|
| Gets the Y-coordinate relative to the page, expressed in the document's |
|
| Indicates the mouse button that triggered the event. |
|
| Gets the number of mouse clicks associated with the event. |
|
| Indicates the mouse wheel direction: |
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);
}
};