Struct PdfRectangle
A rectangle in a PDF file.
public struct PdfRectangle
- Inherited Members
Remarks
PDF coordinates are defined with the origin at the lower left (0, 0). The Y-axis extends vertically upwards and the X-axis horizontally to the right. Unless otherwise specified on a per-page basis, units in PDF space are equivalent to a typographic point (1/72 inch).
Constructors
PdfRectangle(double, double, double, double)
Create a new PdfRectangle.
public PdfRectangle(double x1, double y1, double x2, double y2)
Parameters
x1
doubleBottom left point's x coordinate of the rectangle.
y1
doubleBottom left point's y coordinate of the rectangle.
x2
doubleTop right point's x coordinate of the rectangle.
y2
doubleTop right point's y coordinate of the rectangle.
PdfRectangle(short, short, short, short)
Create a new PdfRectangle.
public PdfRectangle(short x1, short y1, short x2, short y2)
Parameters
x1
shortBottom left point's x coordinate of the rectangle.
y1
shortBottom left point's y coordinate of the rectangle.
x2
shortTop right point's x coordinate of the rectangle.
y2
shortTop right point's y coordinate of the rectangle.
PdfRectangle(PdfPoint, PdfPoint)
Create a new PdfRectangle.
public PdfRectangle(PdfPoint bottomLeft, PdfPoint topRight)
Parameters
bottomLeft
PdfPointBottom left point of the rectangle.
topRight
PdfPointTop right point of the rectangle.
PdfRectangle(PdfPoint, PdfPoint, PdfPoint, PdfPoint)
Create a new PdfRectangle.
public PdfRectangle(PdfPoint topLeft, PdfPoint topRight, PdfPoint bottomLeft, PdfPoint bottomRight)
Parameters
Properties
Area
Area of the rectangle.
public double Area { get; }
Property Value
Bottom
Bottom. This value is only valid if the rectangle is not rotated, check Rotation.
public double Bottom { get; }
Property Value
BottomLeft
Bottom left point of the rectangle.
public readonly PdfPoint BottomLeft { get; }
Property Value
BottomRight
Bottom right point of the rectangle.
public readonly PdfPoint BottomRight { get; }
Property Value
Centroid
Centroid point of the rectangle.
public PdfPoint Centroid { get; }
Property Value
Height
Height of the rectangle.
A positive number.
public double Height { get; }
Property Value
Left
Left. This value is only valid if the rectangle is not rotated, check Rotation.
public double Left { get; }
Property Value
Right
Right. This value is only valid if the rectangle is not rotated, check Rotation.
public double Right { get; }
Property Value
Rotation
Rotation angle of the rectangle. Counterclockwise, in degrees.
-180 ≤ θ ≤ 180
public double Rotation { get; }
Property Value
Top
Top. This value is only valid if the rectangle is not rotated, check Rotation.
public double Top { get; }
Property Value
TopLeft
Top left point of the rectangle.
public readonly PdfPoint TopLeft { get; }
Property Value
TopRight
Top right point of the rectangle.
public readonly PdfPoint TopRight { get; }
Property Value
Width
Width of the rectangle.
A positive number.
public double Width { get; }
Property Value
Methods
ToString()
public override string ToString()
Returns
Translate(double, double)
Creates a new PdfRectangle which is the current rectangle moved in the x and y directions relative to its current position by a value.
public PdfRectangle Translate(double dx, double dy)
Parameters
dx
doubleThe distance to move the rectangle in the x direction relative to its current location.
dy
doubleThe distance to move the rectangle in the y direction relative to its current location.
Returns
- PdfRectangle
A new rectangle shifted on the y axis by the given delta value.