Doc TopDown Property. The current position of the origin. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Read Only Description
[C#] bool

[Visual Basic]
Boolean
false No The current position of the origin.

 

   

Notes
 

PDF coordinates are measured upwards from the bottom of the document. For some types of layout it can be useful to measure coordinates downwards from the top of the document.

By setting this property to true coordinates are assumed to start at the top rather than the bottom of the document.

More precisely the origin is assumed to be at the top-left of the current MediaBox.

There are a variety of methods you can use to change coordinate systems.

Note that transforms operate on the underlying PDF coordinate space rather than any abstraction specified by the Units and TopDown properties. If you are using transforms you will find it easiest to work in the native PDF coordinate space.

 

   

Example
 

The following code creates a PDF document and adds a grid measured in inches.

[C#]
Doc theDoc = new Doc();
theDoc.Units = UnitType.Inches;
theDoc.TopDown = true;
theDoc.Width = 1.0 / 8.0;
theDoc.FontSize = 1;
theDoc.Rect.Pin = XRect.Corner.TopLeft;
for (int i = 0; i <= 12; i += 2) {
  theDoc.AddLine(0, i, 12, i);
  theDoc.Rect.Position(0, i);
  theDoc.AddText(i.ToString());
  theDoc.AddLine(i, 0, i, 12);
  theDoc.Rect.Position(i, 0);
  theDoc.AddText(i.ToString());
}
theDoc.Save(Server.MapPath("doctopdown.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Units = UnitType.Inches
theDoc.TopDown = True
theDoc.Width = 1.0 / 8.0
theDoc.FontSize = 1
theDoc.Rect.Pin = XRect.Corner.TopLeft
For i As Integer = 0 To 12 Step 2
  theDoc.AddLine(0, i, 12, i)
  theDoc.Rect.Position(0, i)
  theDoc.AddText(i.ToString())
  theDoc.AddLine(i, 0, i, 12)
  theDoc.Rect.Position(i, 0)
  theDoc.AddText(i.ToString())
Next
theDoc.Save(Server.MapPath("doctopdown.pdf"))
theDoc.Clear()


doctopdown.pdf