Description
Aspose.PDF cannot support Regexp Group
(like $0
,$1
…) when search and replace string with regexp.
Env
- Windows 10 .NET 4.7
- Aspose.PDF for .NET 22.12
Code
var doc = new Aspose.Pdf.Document(@"C:\Users\XCL\Desktop\test\source.pdf");
var textFragmentAbsorber = new TextFragmentAbsorber("(world)", new TextSearchOptions(true));
doc.Pages.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
{
textFragment.Text = "=$0=";// $0 is not woking.
}
doc.Save(@"C:\Users\XCL\Desktop\test\target.pdf");
Before
image.png (34.2 KB)
After
image.png (33.7 KB)
Test Files
test.zip (153.5 KB)