XTextStyle HPos Property. The current horizontal positioning factor (0 to 1). ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Value Read Only Description
[C#] double

[Visual Basic]
Double
0? No? The current horizontal positioning factor (0 to 1).

 

   

Notes
 

This property determines the horizontal offset of blocks of text - used for left alignment, right alignment or centering.

The offset is measured as a proportion of the distance from the left. A value of zero indicates left alignment, a value of one half indicates centered text and a value of one indicates right alignment. Intermediate values can be used for intermediate offsets.

To vertically align text use the VPos property. To justify text use the Justification property.

 

   

Example
 

The following code adds two blocks of text to a document. The first block is left aligned and the second is right aligned. Before adding the text we change the current rectangle and frame it so that you can see how the text is aligned.

[C#]
Doc theDoc = new Doc();
theDoc.FontSize = 96;
theDoc.Rect.Magnify(1.0, 0.5);
theDoc.Rect.Inset(40, 40);
theDoc.FrameRect();
theDoc.AddText("Left justified text...");
theDoc.Rect.Move(0, theDoc.Rect.Height + 80);
theDoc.FrameRect();
theDoc.TextStyle.HPos = 1.0;
theDoc.AddText("Right justified text...");
theDoc.Save(Server.MapPath("dochpos.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.FontSize = 96
theDoc.Rect.Magnify(1.0, 0.5)
theDoc.Rect.Inset(40, 40)
theDoc.FrameRect()
theDoc.AddText("Left justified text...")
theDoc.Rect.Move(0, theDoc.Rect.Height + 80)
theDoc.FrameRect()
theDoc.TextStyle.HPos = 1.0
theDoc.AddText("Right justified text...")
theDoc.Save(Server.MapPath("dochpos.pdf"))
theDoc.Clear()


dochpos.pdf