Segment

I have segment text, in which part of the text should be aligned left and another part should be aligned right like below:


This is new data, abcdef ghi jk lm no Test Test2
pq rstuv 123

In the above, 123 is also part of the same text and should be aligned right on the same line.

I am generating a PDF document from XML using XSL.


My code is like below:

<Text>
  <Segment>
    This is new data, abcdef ghi jk lm no pq rs
  </Segment>
  <Segment>
    tuv
  </Segment>
  <Segment Alignment="Right">
    123
  </Segment>
</Text>

Thanks

Hi,

Thanks for using our products.

I am afraid you might not be able to define the Alignment information for individual Segment object when using XML file. I have logged this problem as PDFNET-26406 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

However, in order to accomplish your requirements, you can specify the Alignment information for Text object and you can add Segments inside those Text object. Please take a look over the following code and the resultant PDF that I have generated using Aspose.Pdf for .NET 5.1.0

[XML]

<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns="Aspose.Pdf">
<Section>
<Text MarginTop="30" BackgroundColor="Beige" Alignment="Left">
<Segment FontSize="16" Color="Blue">
This is new data, abcdef ghi jk lm no
</Segment>
</Text>

<Text MarginTop="30" Alignment="Right">
<Segment FontSize="16" FontName="Arial" Color="Red">
123
</Segment>
</Text>
</Section>
</Pdf>

The issues you have found earlier (filed as 26406 ) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.