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

Free Support Forum - aspose.app

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);
        TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

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

Best Regards

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");          

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

This topic has been moved to the related forum: https://forum.aspose.com/t/aspose-pdf-text-replace-and-horizontal-alignment-center-not-working/232098