PdfRectangle Struct

A rectangle in user space units (ISO 32000-2, 7.9.5): its lower-left and upper-right corners.

public readonly struct PdfRectangle : IEquatable<PdfRectangle>
Implements

Constructors

NameDescription
PdfRectangle(double, double, double, double)Initializes a new instance of the PdfRectangle struct. The corners are normalized: PdfRectangle.Left is the smaller x coordinate and PdfRectangle.Bottom the smaller y coordinate.

PdfRectangle(double, double, double, double)

PdfRectangle.cs

Initializes a new instance of the PdfRectangle struct. The corners are normalized: PdfRectangle.Left is the smaller x coordinate and PdfRectangle.Bottom the smaller y coordinate.

public PdfRectangle(double x1, double y1, double x2, double y2)

Parameters

x1 double
The x coordinate of a corner.
y1 double
The y coordinate of a corner.
x2 double
The x coordinate of the opposite corner.
y2 double
The y coordinate of the opposite corner.

Properties

NameDescription
BottomGets the smaller y coordinate.
HeightGets the height.
LeftGets the smaller x coordinate.
RightGets the greater x coordinate.
TopGets the greater y coordinate.
WidthGets the width.

Gets the smaller y coordinate.

public double Bottom { get; }

Property value

double

Gets the height.

public double Height { get; }

Property value

double

Gets the smaller x coordinate.

public double Left { get; }

Property value

double

Gets the greater y coordinate.

public double Top { get; }

Property value

double

Gets the width.

public double Width { get; }

Property value

double

Methods

NameDescription
Equals(PdfRectangle)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromSize(double, double, double, double)Creates a rectangle from its lower-left corner and its size.
GetHashCode()Returns the hash code for this instance.
ToArray()Converts the rectangle to an array of four numbers.
ToString()Returns the fully qualified type name of this instance.
TryRead(PdfArray?, PdfRectangle)Reads a rectangle from an array of four numbers.

Equals overloads

Equals(PdfRectangle)

PdfRectangle.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(PdfRectangle other)
Parameters
other PdfRectangle
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

PdfRectangle.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

FromSize(double, double, double, double)

PdfRectangle.cs

Creates a rectangle from its lower-left corner and its size.

public static PdfRectangle FromSize(double x, double y, double width, double height)

Parameters

x double
The x coordinate of the lower-left corner.
y double
The y coordinate of the lower-left corner.
width double
The width.
height double
The height.

Returns

PdfRectangle The rectangle.

GetHashCode()

PdfRectangle.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

Converts the rectangle to an array of four numbers.

public PdfArray ToArray()

Returns

PdfArray The array [left bottom right top].

ToString()

PdfRectangle.cs

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string The fully qualified type name.

TryRead(PdfArray?, PdfRectangle)

PdfRectangle.cs

Reads a rectangle from an array of four numbers.

public static bool TryRead(PdfArray? array, out PdfRectangle rectangle)

Parameters

array PdfArray?
The array.
rectangle PdfRectangle
The rectangle.

Returns

bool true when the array has four numbers.

Operators

NameDescription
operator ==(PdfRectangle, PdfRectangle)Indicates whether two rectangles are equal.
operator !=(PdfRectangle, PdfRectangle)Indicates whether two rectangles are different.

operator ==(PdfRectangle, PdfRectangle)

PdfRectangle.cs

Indicates whether two rectangles are equal.

public static bool operator ==(PdfRectangle left, PdfRectangle right)

Parameters

left PdfRectangle
The first rectangle.
right PdfRectangle
The second rectangle.

Returns

bool true when the rectangles are equal.

operator !=(PdfRectangle, PdfRectangle)

PdfRectangle.cs

Indicates whether two rectangles are different.

public static bool operator !=(PdfRectangle left, PdfRectangle right)

Parameters

left PdfRectangle
The first rectangle.
right PdfRectangle
The second rectangle.

Returns

bool true when the rectangles are different.