How can I create annotation with searching text?
Hi
I have a SfPdfViewer, I need to create a squareAnnotation which surrounds a text that determined by searching function. I've refer that link, but the location is wrong.
I saw that the pdfViewer find text function detected position exactly.
So, how can I draw a annotation exactly with text bounds which's returned by searching function?
Thanks and best regards,
Hi TH,
We are preparing the sample to add the SquareAnnotation within the search text bounds in PdfViewer and will provide further details on April 11, 2024.
Regards,
Deepika R
Hi Deepika Ravi,
Thank for your support. A question please, how can I display search result by SfTreeView like the following screenshots:
Thanks
Hi TH,
Regarding sample for adding the SquareAnnotation within the search text bounds in PdfViewer.
We have prepared the sample for your requirement to add the SquareAnnotation within the search text bounds in PdfViewer. Please find the workaround sample application from the attachment (along with the output screen shot of the same).
Please find the workflow of the sample,
Enter the search text in the search text entry in the sample and initiate the search using the search button.
In the AddSquareAnnotation method, we have handled the extract the searched text bounds information and adding square annotation in the SfPdfViewer.
To find the bounds information of the search text, we used the ExtractText method of the Syncfusion PDF Library package.
We created the SquareAnnotation and added this in PDFViewer with the help of the AddAnnotation method in PDFViewer.
Regards,
Deepika R
Attachment: HighlightSample_f46acf2a.zip
Hi TH,
Regarding display search result by SfTreeView
In .NET MAUI PdfViewer, we have support for retrieving the current search index, total searched text count in the document, and we provide the search options (whole words and case sensitive). Kindly refer to the following UG link to learn more about the search result and search options in PdfViewer.
Search
Result: https://help.syncfusion.com/maui/pdf-viewer/text-search#search-result
Search
Option: https://help.syncfusion.com/maui/pdf-viewer/text-search#text-search-options
We don't have an advanced text search option in PdfViewer. However, we suggest that you can use the ExtractText API to obtain the phrases or lines and bounds information of the searched text. This will help you find the search text details in the document. To learn more about the details of the ExtractText, kindly refer to the below UG documentation link:
To display the phrases in a hierarchical structure as shown in the shared screenshot, you can use the SfTreeView package in Syncfusion. To learn more about the SfTreeView, kindly refer to the below UG documentation link:
https://help.syncfusion.com/maui/treeview/getting-started
Regards,
Deepika R
Thank you, Deepika Ravi,
I resolved my issue.
Best regards,
TH
Hi TH,
We are glad to know that the shared sample meets your requirements. If you need any further assistance, kindly let us know.
Regards,
Deepika R
- 6 Replies
- 2 Participants
- Marked answer
-
TH Thanh Hai Dang
- Apr 7, 2024 02:56 PM UTC
- Apr 17, 2024 04:08 PM UTC