ASPOSE PDF Text Replace and horizontal alignment (center) not working

Hi there, thanks for your time looking into my request.

I am replacing text using Aspose.PDF but the horizontal alignment (center ) is not working. Am I doing anything wrong here or is there some issue with API. Please advise. Please see my code below:

public static void DoFindReplaceText(string find, Aspose.Pdf.Document pdfDocument, string replace)
    {
        TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(find);
        pdfDocument.Pages.Accept(textFragmentAbsorber);
        TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

        foreach (TextFragment textFragment in textFragmentCollection)
        {
            textFragment.HorizontalAlignment = HorizontalAlignment.Center;
            textFragment.Text = replace;
        }
    }

Best Regards
Rupesh

What is the issue with below code, not sure why Center Alignment is not working, Is it API issue. Please advise?

       TextFragmentAbsorber absorber = new TextFragmentAbsorber("FINDTEXT");          
        doc.Pages[1].Accept(absorber);

        absorber.TextFragments[1].Text = "REPLACETEXT";
        absorber.TextFragments[1].HorizontalAlignment = HorizontalAlignment.Center;

This topic has been moved to the related forum: Replace text in PDF document using C# | horizontal alignment (center) not working - Free Support Forum - aspose.com