Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

replace multiple text fragments

$
0
0

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?

 

 

 

 


Viewing all articles
Browse latest Browse all 3131

Trending Articles