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

Free Support Forum - aspose.com

Right aligning text based on a phrase

I’m trying to right align text based on certain phrases. The following code isn’t working.

What is going wrong, is there a better way to do this?

var tfList = textAbsorber.TextFragments.ToList();
var tfAcctNote = tfList.Where(tf => tf.Text == “Account/Note Number”).FirstOrDefault();
var index = tfList.IndexOf(tfAcctNote);
var aligner = tfList[index + 1];
var movers = new List() { “Statement Date”, “Officer”, “Branch Number”, “Current Balance”, “Payment Due Date”, “Amount Due” };
foreach (var tf in tfList)
{
if (movers.Contains(tf.Text))
{
this.logger.LogInformation($“Moving text for {tf.Text}”);
var tfIndex = tfList.IndexOf(tf);
var tfMove = tfList[tfIndex + 1];
textAbsorber.TextFragments.Where(x => x.Text == tfMove.Text).FirstOrDefault().Rectangle.URX = aligner.Rectangle.URX;
}
}

@Davyes

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input PDF document.
  • Please attach the output PDF file that shows the undesired behavior.
  • Please attach the expected output PDF file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.