Table of Contents

Class PdfRectangle

Namespace
PdfSharp.Pdf
Assembly
PdfSharp.dll

Represents an immutable PDF rectangle object. In a PDF file it is represented by an array of four real values.

public sealed class PdfRectangle : PdfPrimitive
Inheritance
object
PdfRectangle
Extension Methods

Constructors

PdfRectangle()

Initializes a new instance of the PdfRectangle class with all values set to zero.

PdfRectangle(XPoint, XPoint)

Initializes a new instance of the PdfRectangle class with two points specifying two diagonally opposite corners.

PdfRectangle(XPoint, XSize)

Initializes a new instance of the PdfRectangle class with the specified location and size.

PdfRectangle(XRect)

Initializes a new instance of the PdfRectangle class with the specified XRect.

Properties

Empty

Represents an empty PdfRectangle.

Height

Gets Y2 - Y1.

IsEmpty

Tests whether all coordinates are zero.

IsZero

Tests whether all coordinates are zero.

Location

Gets the coordinates of the first point of this PdfRectangle.

Size

Gets the size of this PdfRectangle.

Width

Gets X2 - X1.

X1

Gets the x-coordinate of the first corner of this PdfRectangle.

X2

Gets the x-coordinate of the second corner of this PdfRectangle.

Y1

Gets the y-coordinate of the first corner of this PdfRectangle.

Y2

Gets the y-coordinate of the second corner of this PdfRectangle.

Methods

Clone()

Clones this instance.

Contains(XPoint)

Determines if the specified point is contained within this PdfRectangle.

Contains(XRect)

Determines if the rectangular region represented by rect is entirely contained within this PdfRectangle.

Contains(PdfRectangle)

Determines if the rectangular region represented by rect is entirely contained within this PdfRectangle.

Contains(double, double)

Determines if the specified point is contained within this PdfRectangle.

Copy()

Implements cloning this instance.

Equals(object?)

Tests whether the specified object is a PdfRectangle and has equal coordinates.

GetHashCode()

Serves as a hash function for a particular type.

ToString()

Returns the rectangle as a string in the form «[x1 y1 x2 y2]».

ToXRect()

Returns the rectangle as an XRect object.

Operators

operator ==(PdfRectangle?, PdfRectangle?)

Tests whether two instances have equal coordinates.

operator !=(PdfRectangle?, PdfRectangle?)

Tests whether two instances differ in one or more coordinates.