We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

TextFragment and HorizontalAlignment.Justify

i replace any text on a pdf file

TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
{
textFragment.Text = “long text”;
textFragment.TextState.Font = FontRepository.FindFont(“Arial”);
textFragment.TextState.ForegroundColor = Color.Black;
textFragment.HorizontalAlignment = oDataClass.HorizontalAlignment; // HorizontalAlignment.Justify
}
if the text is fit on one line its works but the text is multi line after replacement i can see only one line of the text
its not wrap

@iuzunok

Thanks for contacting support.

Please note that we do not recommend to use extremely long fragment for replacement of short one because it may lead to last paragraph string becomes too long. However, you may use following option in order to get desired output.

textFragmentAbsorber.TextReplaceOptions.ReplaceAdjustmentAction =
     TextReplaceOptions.ReplaceAdjustment.WholeWordsHyphenation;

In case if you still face any issue, please share your sample PDF document with us, so that we can test the scenario in our environment and address it accordingly.