Using the code below, I can replace a text fragment in an PDF file.
Aspose.Pdf.
Document doc = new Aspose.Pdf.Document(@"test.pdf");
TextFragmentAbsorber tfa = newTextFragmentAbsorber("@CurrentDateTime");
doc.Pages.Accept(tfa);
TextFragmentCollection tfc = tfa.TextFragments;
foreach (TextFragment tf in tfc)
tf.Text =
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss tt");
doc.Save(
@"test.pdf");
Aspose.Pdf.
Document doc = new Aspose.Pdf.Document(@"test.pdf");
TextFragmentAbsorber tfa = newTextFragmentAbsorber("@CurrentDateTime");
doc.Pages.Accept(tfa);
TextFragmentCollection tfc = tfa.TextFragments;
foreach (TextFragment tf in tfc)
tf.Text =
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss tt");
doc.Save(
@"test.pdf");
How do I replace multiple text fragments within the document?