Find/Replace functionality

Hi,

Can you tell me if it is possible to build a "find/replace" function for the text in FreeTextAnnotations in the PdfViewer control?

Is it possible to share a small code sample if it's possible?

Thanks!


1 Reply 1 reply marked as answer

RB Rajavignesh BalaSankar Syncfusion Team July 7, 2022 01:54 PM UTC

Hi Wouter,


We do not have support to find and replace text present in the Free Text Annotation. However, we can achieve your requirement by modifying the loadedDocument property of PdfViewer and reloading it as a work around. We have also created a sample for the same and attached below.


In the sample, Enter the word that you need to find in the free text annotations in the find text box and enter the word that you want replace for the found word in the Replace TextBox and then click the “Replace All” button. When you click the button, it will check the text of the annotations present in the loadedDocument and then replaces the found occurrences. Once replaced, it will be saved as a Memory stream and then again loaded into the PdfViewer.


For Example: In the provided sample, Enter the word “Hellow” in the find textbox and enter “Helo” in the replace text box and then click the “Replace All” Button. Now the word “Hellow” present in the freetext annotations will be changed to “Helo”.


Please let us know if you need further assistance on this.


Regards,

Raja Vignesh.


Attachment: Find_And_Replace_ae752bbb.zip

Marked as answer
Loader.
Up arrow icon