Env
- Windows 11
- Aspose.PDF for .NET 24.1
Code
void Test()
{
var doc = new Aspose.Pdf.Document(@"C:\Users\Administrator\Desktop\test\test.pdf");
var textFragmentAbsorber = new TextFragmentAbsorber("关注微信公众号“捷思课堂”获取更多学习资料!");
doc.Pages.Accept(textFragmentAbsorber);
var textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (var textFragment in textFragmentCollection)
{
textFragment.Text="123456789,123456789,123456789,123456789";
}
doc.Save(@"C:\Users\Administrator\Desktop\test\out.pdf");
}
Test Files
before.png (66.8 KB)
after.png (70.3 KB)
test.zip (294.8 KB)