Touch interaction events in Xamarin Pdf Viewer (SfPdfViewer)

Tapped

The Tapped event will be triggered when the user taps on the document display area of the PDF Viewer control. The event argument of this event contains the following information:

  • PageNumber : The page number in which the tap event occurred.
  • Position : The position of the tap event location with respect to the start of the page.

DoubleTapped

The DoubleTapped event will be triggered when the user double taps on the document display area of the PDF Viewer control. The event argument of this event contains the following information:

  • PageNumber : The page number in which the double tap event occurred.
  • Position : The position of the double tap event location with respect to the start of the page.

LongPressed

The LongPressed event triggered when the user long presses on the document display area of the PDF Viewer control. The event argument of this event contains the following information:

  • PageNumber : The page number in which the double tap event occurred.
  • Position : The position of the double tap event location with respect to the start of the page.
<Grid x:Name="pdfViewGrid">
<syncfusion:SfPdfViewer x:Name="pdfViewerControl" Tapped="PdfViewerControl_Tapped"
DoubleTapped="PdfViewerControl_DoubleTapped" LongPressed="PdfViewerControl_LongPressed"
InputFileStream="{Binding PdfDocumentStream}"/>
</Grid>
public MainPage()
{
InitializeComponent();

}

private void PdfViewerControl_LongPressed(object sender, Syncfusion.SfPdfViewer.XForms.TouchInteractionEventArgs e)
{
//Gets the page number of the PDF Viewer where you tapped.
int pageNumber = e.PageNumber;
//Gets the position of the PDF Viewer where you tapped.
Point position = e.Position;
}

private void PdfViewerControl_DoubleTapped(object sender, Syncfusion.SfPdfViewer.XForms.TouchInteractionEventArgs e)
{
//Gets the page number of the PDF Viewer where you double tapped.
int pageNumber = e.PageNumber;
//Gets the position of the PDF Viewer where you double tapped.
Point position = e.Position;
}

private void PdfViewerControl_Tapped(object sender, Syncfusion.SfPdfViewer.XForms.TouchInteractionEventArgs e)
{
//Gets the page number of the PDF Viewer where you long pressed.
int pageNumber = e.PageNumber;
//Gets the position of the PDF Viewer where you long pressed.
Point position = e.Position;
}