XPoint Point Property. The System.Drawing.Point. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Read Only Description
[C#] Point

[Visual Basic]
Point
n/a No The System.Drawing.Point.

 

   

Notes
 

The point as a System.Drawing Point.

Windows coordinates are measured in distances from the top left of the drawing surface while PDF coordinates are measured from the bottom left.

So when you use this property the coordinates must be re-mapped. This needs to be done in the context of a containing object. Properties such as the Doc.Pos are interpreted in the context of the Doc.MediaBox. If there is no containing object then no re-mapping can be performed.

You may find it easier to work with .NET Points than PDF points. However remember that operations such as Transforms work on the underlying PDF coordinates and not on the abstracted Windows coordinates.

 

   

Example
 

The following code adds three words to a document. The positioning is done using standard .NET Points.

[C#]
Doc theDoc = new Doc();
theDoc.FontSize = 96;
Point pt = theDoc.Pos.Point;
pt.Offset(100, 150);
theDoc.Pos.Point = pt;
theDoc.AddText("One");
pt.Offset(100, 150);
theDoc.Pos.Point = pt;
theDoc.AddText("Two");
pt.Offset(100, 150);
theDoc.Pos.Point = pt;
theDoc.AddText("Three");
theDoc.Save(Server.MapPath("xptpt.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.FontSize = 96
Dim pt As Point = theDoc.Pos.Point
pt.Offset(100, 150)
theDoc.Pos.Point = pt
theDoc.AddText("One")
pt.Offset(100, 150)
theDoc.Pos.Point = pt
theDoc.AddText("Two")
pt.Offset(100, 150)
theDoc.Pos.Point = pt
theDoc.AddText("Three")
theDoc.Save(Server.MapPath("xptpt.pdf"))
theDoc.Clear()


xptpt.pdf