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>
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.