Type Default Read Only Description
[C#]
XPoint

[Visual Basic]
XPoint
The top left of the current rectangle. No The current drawing position.

 

   

Notes
 

This property determines the current drawing position. This is used by the AddText method.

When you change the Page or Rect properties the Pos is automatically reset to the top left of the current Rect. After adding text using the AddText method the Pos is updated to point to the next text insertion position - just after the last drawn character.

When adding text with AddText or AddHtml, Pos specifies the top left corner of characters, and text is positioned in rows going from left to right and ordered from top to bottom. However, when Font is set to a vertical font (a font in the vertical writing mode/FontObject.WritingMode), text is positioned in columns going from top to bottom and ordered from right to left as in East Asian scripts. The value of Pos is not changed by a change in Font. This works because with vertical text flow, an internal transformation (which is only a manifestation of the text processing) is applied to Pos (only Pos and nothing else), and all horizontal positioning settings are applied to vertical coordinates and vice versa. (Note that the effects of XTextStyle.CharSpacing and XTextStyle.WordSpacing depend on the writing mode.) The transformation rotates the coordinate system by 90 degrees clock-wise and maps the top-left corner of the Rect to the top-right corner of the Rect. Hence, the default initial value of Pos specifies vertical text to start at the top-right corner of the Rect. This is similar to Windows processing of text using an East Asian font whose name is prefixed with @ and applying the transformation only at the last step.

Please note that text in vertical fonts and text in horizontal fonts do not mix well without additional positioning so it is not recommended to use horizontal fonts with AddHtml when Font is set to a vertical font or vice versa.

 

   

Example
 

The following code creates a PDF document with text positioned at a number of different points within it.

[C#]
Doc theDoc = new Doc();
theDoc.FontSize = 48;
for (int i = 1; i <= 8; i++) {
  theDoc.Pos.X = i * 40;
  theDoc.Pos.Y = i * 80;
  theDoc.AddText("Pos = " + theDoc.Pos.String);
}
theDoc.Save(Server.MapPath("docpos.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.FontSize = 48
For i As Integer = 1 To 8
  theDoc.Pos.X = i * 40
  theDoc.Pos.Y = i * 80
  theDoc.AddText("Pos = " + theDoc.Pos.String)
Next
theDoc.Save(Server.MapPath("docpos.pdf"))
theDoc.Clear()


docpos.pdf