this.pdfViewerControl.TextSelectionCompleted += PdfViewerControl_TextSelectionCompleted;
private void PdfViewerControl_TextSelectionCompleted(object sender, Syncfusion.SfPdfViewer.XForms.TextSelectionCompletedEventArgs args)
{
//The selected text is acquired and stored in the variable selectedText.
string selectedText = args.SelectedText;
//The number of the page in which the selection is performed is acquired.
int pageNumber = args.PageNumber;
//The bounds of the page in which the selection is performed is acquired.
Rectangle pageBounds = args.PageBounds;
//The region of the text being selected is acquired.
Rectangle selectedRegion = args.SelectedRegion;
} |
Hi Roman,At present, we cannot “get the text from the tapped position” using SfPdfViewer tapped event. However, we can get the text while performing long press on the required text from the ‘TextSelectionCompleted’ event. Please find the below code snippet for your reference.
this.pdfViewerControl.TextSelectionCompleted += PdfViewerControl_TextSelectionCompleted;private void PdfViewerControl_TextSelectionCompleted(object sender, Syncfusion.SfPdfViewer.XForms.TextSelectionCompletedEventArgs args){//The selected text is acquired and stored in the variable selectedText.string selectedText = args.SelectedText;//The number of the page in which the selection is performed is acquired.int pageNumber = args.PageNumber;//The bounds of the page in which the selection is performed is acquired.Rectangle pageBounds = args.PageBounds;//The region of the text being selected is acquired.Rectangle selectedRegion = args.SelectedRegion;}Please find the below UG documentation link for your reference,
Kindly let us know whether the above proposed solution meets your requirement.With Regards,Gayathri R
Thanks! This solution works, but it does not meet our requirements.
We need at least to find the line and the nearest letter of the text to the position received from the Tap/DoubleTap event.
It might be not straight-forward and works at least for Android. If you have this feature, it would be really nice and convenient.