Struct PdfBounds
- Namespace
- DocToolkit
- Assembly
- DocToolkit.Pdf.dll
Where something sits on a PDF page, in PDF user-space points.
public readonly record struct PdfBounds : IEquatable<PdfBounds>
- Implements
- Inherited Members
Remarks
The origin is the BOTTOM-left corner of the page, and Bottom grows upwards. That is the PDF coordinate system rather than a screen one, and it is the commonest surprise when these values are first plotted — a word near the top of an A4 page has a Bottom near 842, not near 0. It is stated here rather than left to be discovered.
One point is 1/72 inch, so A4 is 595 × 842 and US Letter is 612 × 792.
This is a value type deliberately. A page of prose produces one of these per word, and a reference type would allocate twice per word for no gain — the whole thing is four doubles.
It is also this library's own type rather than PdfPig's PdfRectangle, which keeps PdfPig
out of the public API. PdfTextExtractor is the only file here that references PdfPig, and
returning one of its types from PdfEditor would end that boundary — a consumer
would then need a PdfPig reference to name the result of a call.
Constructors
PdfBounds(double, double, double, double)
Creates a rectangle from its lower-left corner and its size.
public PdfBounds(double left, double bottom, double width, double height)
Parameters
leftdoubleDistance from the page's left edge, in points.
bottomdoubleDistance from the page's BOTTOM edge, in points.
widthdoubleWidth in points.
heightdoubleHeight in points.
Properties
Bottom
Distance from the page's bottom edge, in points. Larger means higher up the page.
public double Bottom { get; }
Property Value
Height
Height in points.
public double Height { get; }
Property Value
Left
Distance from the page's left edge, in points.
public double Left { get; }
Property Value
Right
Distance from the page's left edge to the right-hand side, in points.
public double Right { get; }
Property Value
Top
Distance from the page's bottom edge to the top side, in points.
public double Top { get; }
Property Value
Width
Width in points.
public double Width { get; }