Right-to-left aligned languages such as Arabic, Hebrew and Urdu are also supported in Aspose.Pdf . TextInfo.IsRightToLeft property can be used for any Text Segment to specify whether to align the text from right to left or not.
TextInfo.IsRightToLeft is a boolean property that can be set to true or false to achieve the desired output.
Note:Currently only normal fonts such as "Times New Roman" are supported. Specific fonts such as "Traditional Arabic" are not supported.
The following example shows how to use right-to-left aligned language.
Example:
[C#]
//Store some arabic text in a string variable
string str = "البارز .NET أسبوز هو بائع عنصر ال";
//Create a text object and pass the string object carrying arabic text in it
Text text1 = new Text(str);
//Enable text alignment from right to left
text1.Segments[0].TextInfo.IsRightToLeft = true;
//Enable unicode character set for the text segment
text1.Segments[0].TextInfo.IsUnicode = true;
//Set Font Name
text1.Segments[0].TextInfo.FontName = "Times New Roman";
//Set font size
text1.Segments[0].TextInfo.FontSize = 14;
//Align text to right hand side using AlignmentType enumeration
text1.Segments[0].TextInfo.Alignment = AlignmentType.Right;
[VB.NET]
'Store some arabic text in a string variable
Dim str As String = "البارز .NET أسبوز هو بائع عنصر ال";
'Create a text object and pass the string object carrying arabic text in it
Dim text1 As Text = New Text(str)
'Enable text alignment from right to left
text1.Segments(0).TextInfo.IsRightToLeft = True
'Enable unicode character set for the text segment
text1.Segments(0).TextInfo.IsUnicode = True
'Set Font Name
text1.Segments(0).TextInfo.FontName = "Times New Roman"
'Set font size
text1.Segments(0).TextInfo.FontSize = 14
'Align text to right hand side using AlignmentType enumeration
text1.Segments(0).TextInfo.Alignment = AlignmentType.Right
[XML]
<Text>
<Segment FontName="Times New Roman" FontSize="14"
IsRightToLeft="true" Alignment="right" IsUnicode="true">
البارز .NET أسبوز هو بائع عنصر ال
</Segment>
</Text>