I am using Aspose software for pdf generation but having issues while replacing text using TextFragment. Suppose I have a text in a table column with replacement parameter.
My name is
@name@
and I am from
@place@.
If I replace with some text, the next line does not get pulled automatically.
My name is
KK
and I am from
XXX
but it should produce result like
My name is
KK and I am
from XXX.
var textFragmentAbsorber = new TextFragmentAbsorber(searchPattern) { TextSearchOptions = new TextSearchOptions(true) };
textFragmentAbsorber.TextReplaceOptions = new TextReplaceOptions(ReplaceAdjustment.AdjustSpaceWidth);
pdfDoc.Pages.Accept(textFragmentAbsorber);
if (textFragmentAbsorber.TextFragments != null)
{
foreach (TextFragment tf in textFragmentAbsorber.TextFragments)
{
if (tf.Text.Equals("name"))
{
tf.Text = "KK"
}
}
}