Show / Hide Table of Contents

Class Rect

Rect is a utility class used to manipulate PDF rectangle objects (refer to section 3.8.3 of the PDF Reference Manual).

Rect can be associated with a SDF/Cos rectangle array using Rect(Obj*) constructor or later using Rect::Attach(Obj*) or Rect::Update(Obj*) methods.

Rect keeps a local cache for rectangle points so it is necessary to call Rect::Update() method if the changes to the Rect should be saved in the attached Cos/SDF array.

Inheritance
System.Object
Rect
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: pdftron.PDF
Assembly: PDFTronDotNet.dll
Syntax
public class Rect : IDisposable
Remarks

Although rectangles are conventionally specified by their lower-left and upperright corners, it is acceptable to specify any two diagonally opposite corners.

Constructors

Rect()

Rect default constructor.

Declaration
public Rect()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Rect(Obj)

Create a Rect and initialize it using given Cos/SDF rectangle Array object. The rect is attached to this object.

Declaration
public Rect(Obj rect)
Parameters
Type Name Description
Obj rect

the rect

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Rect(Double, Double, Double, Double)

Create a Rect and initialize it using specified parameters. The rect is not attached to any Cos/SDF object.

Declaration
public Rect(double x1, double y1, double x2, double y2)
Parameters
Type Name Description
System.Double x1

x coordinate of the bottom left corner

System.Double y1

y coordinate of the bottom left corner

System.Double x2

x coordinate of the top right corner

System.Double y2

y coordinate of the top right corner

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Properties

x1

x coordinate of the bottom left corner

Declaration
public double x1 { get; set; }
Property Value
Type Description
System.Double

x2

x coordinate of the top right corner

Declaration
public double x2 { get; set; }
Property Value
Type Description
System.Double

y1

y coordinate of the bottom left corner

Declaration
public double y1 { get; set; }
Property Value
Type Description
System.Double

y2

y coordinate of the top right corner

Declaration
public double y2 { get; set; }
Property Value
Type Description
System.Double

Methods

Attach(Obj)

Attach the Cos/SDF object to the Rect.

Declaration
public void Attach(Obj obj)
Parameters
Type Name Description
Obj obj
  • underlying Cos/SDF object. Must be an SDF::Array with four SDF::Number elements.
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Contains(Double, Double)

Determines if the specified point is contained within the rectangular region defined by this Rectangle.

Declaration
public bool Contains(double x, double y)
Parameters
Type Name Description
System.Double x

x coordinate of the specified point

System.Double y

y coordinate of the specified point

Returns
Type Description
System.Boolean

true is the point is in the rectangle, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Finalize()

Releases all resources used by the Rect

Declaration
protected void Finalize()

Get(Double, Double, Double, Double)

Gets the Rectangle coordinates

Declaration
public void Get(double out_x1, double out_y1, double out_x2, double out_y2)
Parameters
Type Name Description
System.Double out_x1

x coordinate of the bottom left corner

System.Double out_y1

y coordinate of the bottom left corner

System.Double out_x2

x coordinate of the top right corner

System.Double out_y2

y coordinate of the top right corner

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Height()

Gets the height.

Declaration
public double Height()
Returns
Type Description
System.Double

rectangle's height

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Inflate(Double)

Inflate.

Declaration
public void Inflate(double amount)
Parameters
Type Name Description
System.Double amount

amount of inflate

Inflate(Double, Double)

Inflate.

Declaration
public void Inflate(double x, double y)
Parameters
Type Name Description
System.Double x

the x

System.Double y

the y

IntersectRect(Rect, Rect)

Makes a Rect equal to the intersection of two existing rectangles.

Declaration
public bool IntersectRect(Rect rect1, Rect rect2)
Parameters
Type Name Description
Rect rect1
  • A Rect object that contains a source rectangle.
Rect rect2
  • A Rect object that contains a source rectangle.
Returns
Type Description
System.Boolean

true if the intersection is not empty; 0 if the intersection is empty.

Remarks

The intersection is the largest rectangle contained in both existing rectangles.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Normalize()

Normalizes the rectagle to the one with lower-left and upper-right corners.

Declaration
public void Normalize()
Remarks

Although rectangles are conventionally specified by their lower-left and upper-right corners, it is acceptable to specify any two diagonally opposite corners.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

op_Assign(Rect)

Assignment operator

Declaration
public Rect op_Assign(Rect rr)
Parameters
Type Name Description
Rect rr

a Rect object at the right of the operator

Returns
Type Description
Rect

a Rect object equals to the given Rect object

Set(Rect)

Set the coordinates of the rectangle.

Declaration
public void Set(Rect p)
Parameters
Type Name Description
Rect p

the r

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Set(Double, Double, Double, Double)

Set the coordinates of the rectangle.

Declaration
public void Set(double x1, double y1, double x2, double y2)
Parameters
Type Name Description
System.Double x1

x coordinate of the bottom left corner

System.Double y1

y coordinate of the bottom left corner

System.Double x2

x coordinate of the top right corner

System.Double y2

y coordinate of the top right corner

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Update()

Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle.

Declaration
public bool Update()
Returns
Type Description
System.Boolean

true if the attached Cos/SDF rectangle array was successfully updated, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Update(Obj)

Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle.

Declaration
public bool Update(Obj obj)
Parameters
Type Name Description
Obj obj
  • an SDF array that should be updated and attached to this Rect. If parameter rect is NULL or is omitted, update is performed on previously attached Cos/SDF rectangle.
Returns
Type Description
System.Boolean

true if the attached Cos/SDF rectangle array was successfully updated, false otherwise.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Width()

Gets the width.

Declaration
public double Width()
Returns
Type Description
System.Double

rectangle's width

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Implements

System.IDisposable
Back to top Generated by DocFX