Table of Contents

Class PdfRectangle

Namespace
PdfSharp.Pdf
Assembly
PdfSharp.dll

Represents a PDF rectangle value, that is internally an array with 4 real values.

public sealed class PdfRectangle : PdfItem, ICloneable
Inheritance
PdfRectangle
Implements
Inherited Members

Constructors

PdfRectangle()

Initializes a new instance of the PdfRectangle class.

public PdfRectangle()

PdfRectangle(XPoint, XPoint)

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

public PdfRectangle(XPoint pt1, XPoint pt2)

Parameters

pt1 XPoint
pt2 XPoint

PdfRectangle(XPoint, XSize)

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

public PdfRectangle(XPoint pt, XSize size)

Parameters

pt XPoint
size XSize

PdfRectangle(XRect)

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

public PdfRectangle(XRect rect)

Parameters

rect XRect

Fields

Empty

Represents an empty PdfRectangle.

public static readonly PdfRectangle Empty

Field Value

PdfRectangle

Properties

Height

Gets Y2 - Y1.

public double Height { get; }

Property Value

double

IsEmpty

Tests whether all coordinates are zero.

public bool IsEmpty { get; }

Property Value

bool

Location

Gets or sets the coordinates of the first point of this PdfRectangle.

public XPoint Location { get; }

Property Value

XPoint

Size

Gets or sets the size of this PdfRectangle.

public XSize Size { get; }

Property Value

XSize

Width

Gets X2 - X1.

public double Width { get; }

Property Value

double

X1

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

public double X1 { get; }

Property Value

double

X2

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

public double X2 { get; }

Property Value

double

Y1

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

public double Y1 { get; }

Property Value

double

Y2

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

public double Y2 { get; }

Property Value

double

Methods

Clone()

Clones this instance.

public PdfRectangle Clone()

Returns

PdfRectangle

Contains(XPoint)

Determines if the specified point is contained within this PdfRectangle.

public bool Contains(XPoint pt)

Parameters

pt XPoint

Returns

bool

Contains(XRect)

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

public bool Contains(XRect rect)

Parameters

rect XRect

Returns

bool

Contains(PdfRectangle)

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

public bool Contains(PdfRectangle rect)

Parameters

rect PdfRectangle

Returns

bool

Contains(double, double)

Determines if the specified point is contained within this PdfRectangle.

public bool Contains(double x, double y)

Parameters

x double
y double

Returns

bool

Copy()

Implements cloning this instance.

protected override object Copy()

Returns

object

Equals(object?)

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

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

Serves as a hash function for a particular type.

public override int GetHashCode()

Returns

int

ToString()

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

public override string ToString()

Returns

string

ToXRect()

Returns the rectangle as an XRect object.

public XRect ToXRect()

Returns

XRect

Operators

operator ==(PdfRectangle?, PdfRectangle?)

Tests whether two structures have equal coordinates.

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

Parameters

left PdfRectangle
right PdfRectangle

Returns

bool

operator !=(PdfRectangle?, PdfRectangle?)

Tests whether two structures differ in one or more coordinates.

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

Parameters

left PdfRectangle
right PdfRectangle

Returns

bool