Hello,
When I am going to replace 10 digit with xxxxxxxxxx using below code. It
is working properly if there is single occurrence of 10 digit but same
code is not working if I keep 10 digit two times in line. For eg. If I keep
9898989898 it will replace with xxxxxxxxxx but when I keep this as 9898989898 /
1234567890 then code is replace only first occurrence (9898989898 is replaced)
but 1234567890 is remains as it is.
I got same issue while replacing email address instead of 10 digit.
Code which I used is as Under
TextFragmentAbsorber textFragmentAbsorberForPhoneNumber = new TextFragmentAbsorber("\\d{10}"); //like 1999-2000
//set text search option to specify regular expression usage
textFragmentAbsorberForPhoneNumber.TextSearchOptions = textSearchOptions;
//accept the absorber for all the pages
pdfDocument.Pages.Accept(textFragmentAbsorberForPhoneNumber);
//get the extracted text fragments
textFragmentCollection = textFragmentAbsorberForPhoneNumber.TextFragments;
//loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
//update text and other properties
textFragment.Text = "XXXXXXXXXX";
textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);
textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);
}
Please reply ASAP.
Thanks,
Jignesh Chauhan