find and replace text in a pdf file

Hi, 


I want to find and replace text in a pdf file. we have a regex to match the content to be replaced. i saw some solutions to draw a white box over it but that will not work since the content we are replacing is tags that will be recognized by another platform. we want to completely remove this from the page.


also im trying to use this

loadedDocument.FindText(listOfTags, out matchedTextbounds);


with these two packages

<PackageReference Include="Syncfusion.EJ2.PdfViewer.AspNet.Core" Version="27.2.2" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="27.2.2" />


Argument 1: cannot convert from 'System.Collections.Generic.List<string>' to 'string'CS1503
(local variable) List<string> listOfTags

im getting above error


Please let me know if anything is required

thanks,

Rangita


1 Reply 1 reply marked as answer

IJ Irfana Jaffer Sadhik Syncfusion Team November 22, 2024 11:51 AM UTC

Hi Rangita,


We suspect your need is to search a list of string and replace the string in the PDF document. We have prepared a sample for your requirement. Please try this on your end and let us know the result.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/NetCoreSample_(1)-1553467708


If you are still facing an issue, we request you to share the modified sample along with the input document and your complete requirement with us. So that we can assist with you further in this.


Regards,

Irfana J.


Marked as answer
Loader.
Up arrow icon