Table of Contents

Class PdfPageObject

Namespace
nebulae.dotPDFium
Assembly
dotPDFium.dll

Represents a page object within a PDF document, such as text, images, or shapes.

public class PdfPageObject : PdfObject, IDisposable
Inheritance
PdfPageObject
Implements
Derived
Inherited Members

Remarks

This class provides methods to manipulate and retrieve information about a specific page object. Page objects are elements that make up the content of a PDF page, and they can be transformed or queried for their properties, such as bounds.

Fields

_hasOwner

protected bool _hasOwner

Field Value

bool

Methods

AddMark(string)

Adds a mark with the specified tag to the PDF page object.

public PdfMark AddMark(string tag)

Parameters

tag string

The tag identifying the mark to be added. Cannot be null, empty, or consist only of whitespace.

Returns

PdfMark

A PdfMark instance representing the newly added mark.

Exceptions

ArgumentException

Thrown if tag is null, empty, or consists only of whitespace.

dotPDFiumException

Thrown if the mark could not be added to the page object.

Dispose(bool)

The dispose method for the PdfPageObject class. This method is called to release the resources used by this object. It overrides the base class Dispose method to ensure that the native handle is properly destroyed.

protected override void Dispose(bool disposing)

Parameters

disposing bool

GetBounds()

Gets the bounds of the page object. The bounds are represented as a rectangle defined by its left, bottom, right, and top.

public FsRectF GetBounds()

Returns

FsRectF

Exceptions

dotPDFiumException

GetClipPath()

Retrieves the handle to the clip path associated with the current page object.

public nint? GetClipPath()

Returns

nint?

A nullable nint representing the handle to the clip path. Returns null if no clip path is associated with the page object.

GetFillColor()

Retrieves the fill color of the PDF page object.

public RgbaColor GetFillColor()

Returns

RgbaColor

An RgbaColor structure representing the fill color of the object, including red, green, blue, and alpha channel values.

Exceptions

dotPDFiumException

Thrown if the fill color cannot be retrieved due to an error in the underlying PDF library.

GetIsActive()

Determines whether the current page object is active.

public bool GetIsActive()

Returns

bool

true if the page object is active; otherwise, false.

Remarks

This method checks the active state of the page object associated with the current instance. If the underlying operation fails, the method returns false.

GetMark(int)

Retrieves the PdfMark at the specified index.

public PdfMark GetMark(int index)

Parameters

index int

The zero-based index of the mark to retrieve. Must be within the range of available marks.

Returns

PdfMark

The PdfMark at the specified index.

Exceptions

ArgumentOutOfRangeException

Thrown if index is less than 0 or greater than or equal to the total number of marks.

dotPDFiumException

Thrown if the mark cannot be retrieved due to an internal error.

GetMarkCount()

Gets the number of marks associated with the current PDF page object.

public int GetMarkCount()

Returns

int

The total number of marks present in the PDF page object. Returns 0 if no marks are associated.

Remarks

Marks are metadata or annotations associated with a PDF page object. This method retrieves the count of such marks.

GetMarkedContentId()

Gets the marked content ID (MCID) associated with this page object.

public int GetMarkedContentId()

Returns

int

The marked content ID, or -1 if none is associated.

Remarks

The MCID is used in tagged/structured PDFs to associate content with logical structure. Returns -1 if no MCID is present.

GetMatrixF()

Retrieves the transformation matrix associated with the current PDF object.

public FsMatrixF GetMatrixF()

Returns

FsMatrixF

An FsMatrixF representing the transformation matrix of the PDF object.

Exceptions

dotPDFiumException

Thrown if the transformation matrix cannot be retrieved due to an error in the underlying PDF library.

GetRotatedBounds()

Retrieves the rotated bounding box of the current PDF page object.

public FsQuadPointsF GetRotatedBounds()

Returns

FsQuadPointsF

A FsQuadPointsF structure representing the four corners of the rotated bounding box.

Exceptions

dotPDFiumException

Thrown if the operation fails to retrieve the rotated bounds.

GetStrokeColor()

Retrieves the stroke color of the current PDF page object.

public RgbaColor GetStrokeColor()

Returns

RgbaColor

An RgbaColor structure representing the stroke color, including red, green, blue, and alpha channel values.

Exceptions

dotPDFiumException

Thrown if the stroke color cannot be retrieved due to an error in the underlying PDF library.

GetStrokeWidth()

Retrieves the stroke width of the current PDF page object.

public float GetStrokeWidth()

Returns

float

The stroke width of the PDF page object as a float.

Exceptions

dotPDFiumException

Thrown if the stroke width cannot be retrieved due to an error in the underlying PDF library.

HasTransparency()

Determines whether the PDF page object has transparency.

public bool HasTransparency()

Returns

bool

true if the PDF page object contains transparent elements; otherwise, false.

Remarks

This method checks for the presence of transparency in the PDF page object, which may affect rendering or printing.

RemoveMark(PdfMark)

Removes the specified mark from the PDF page object.

public void RemoveMark(PdfMark mark)

Parameters

mark PdfMark

The PdfMark to be removed. Must not be null.

Exceptions

dotPDFiumException

Thrown if the mark could not be removed from the page object.

ScaleBy(double, double)

Scales the object by the specified factors in the x and y directions. The scaling is done relative to the original position of the object. The parameters sx and sy are the scaling factors in the x and y directions,

public void ScaleBy(double sx, double sy)

Parameters

sx double
sy double

ScaleByF(float, float)

Scales the object by the specified factors in the x and y directions. The scaling is done relative to the original position of the object. The parameters sx and sy are the scaling factors in the x and y directions,

public void ScaleByF(float sx, float sy)

Parameters

sx float
sy float

ScaleTo(double, double)

Scales the object to fit within the specified width and height. The scaling is done relative to the original position of the object. The parameters targetWidth and targetHeight are the desired dimensions

public void ScaleTo(double targetWidth, double targetHeight)

Parameters

targetWidth double

Desired width

targetHeight double

Desired height

Exceptions

InvalidOperationException

Thrown when the object bounds are zero

ScaleToF(float, float)

Scales the object to fit within the specified width and height. The scaling is done relative to the original position of the object. The parameters targetWidth and targetHeight are the desired dimensions

public void ScaleToF(float targetWidth, float targetHeight)

Parameters

targetWidth float

Desired width

targetHeight float

Desired height

Exceptions

InvalidOperationException

Thrown when the object bounds are zero

SetFillColor(RgbaColor)

public void SetFillColor(RgbaColor color)

Parameters

color RgbaColor

SetIsActive(bool)

Sets the active state of the PDF page object.

public void SetIsActive(bool active)

Parameters

active bool

true to activate the page object; false to deactivate it.

Remarks

The active state of a page object may influence its visibility or behavior in certain contexts. Ensure that the appropriate state is set based on the desired outcome.

SetMatrix(FsMatrixF)

Sets the transformation matrix for the current PDF page object.

public void SetMatrix(FsMatrixF matrix)

Parameters

matrix FsMatrixF

The transformation matrix to apply. This defines how the page object is scaled, rotated, or translated.

Exceptions

dotPDFiumException

Thrown if the matrix could not be applied. The exception message will contain additional details about the failure.

SetPosition(double, double)

Sets the x, y position of the page object. x is the horizontal distance from the left edge of the page and y is the vertical distance from the bottom edge of the page.

public void SetPosition(double x, double y)

Parameters

x double

The horizontal distance from the left edge of the page

y double

The vertical distance from the bottom edge of the page

SetPositionF(float, float)

Sets the x, y position of the page object. x is the horizontal distance from the left edge of the page and y is the vertical distance from the bottom edge of the page.

public void SetPositionF(float x, float y)

Parameters

x float

The horizontal distance from the left edge of the page

y float

The vertical distance from the bottom edge of the page

SetStrokeColor(RgbaColor)

Sets the stroke color for the current PDF page object.

public void SetStrokeColor(RgbaColor color)

Parameters

color RgbaColor

The RgbaColor structure representing the stroke color, including red, green, blue, and alpha components.

Remarks

The stroke color determines the color used for drawing the outline of shapes or paths in the PDF page object. Ensure that the color parameter contains valid RGBA values, where each component is in the range of 0 to 255.

SetStrokeWidth(float)

Sets the stroke width for the current PDF page object.

public void SetStrokeWidth(float width)

Parameters

width float

The width of the stroke, in points. Must be a non-negative value.

Exceptions

dotPDFiumException

Thrown if the operation fails due to an error in the underlying PDF library.

Transform(FsMatrix)

Transforms a page object using a specified transformation matrix. The transformation matrix is defined by the six parameters: a, b, c, d, e, and f. This method modifies the object's position and size on the page.

public void Transform(FsMatrix matrix)

Parameters

matrix FsMatrix

TransformClipPath(FsMatrix)

Applies a transformation to the clip path of the current page object using the specified matrix.

public void TransformClipPath(FsMatrix matrix)

Parameters

matrix FsMatrix

The transformation matrix to apply. The matrix defines how the clip path should be scaled, rotated, translated, or skewed. Each component of the matrix must be specified.

Remarks

This method modifies the clip path of the page object by applying the given transformation matrix. Ensure that the matrix is properly defined to achieve the desired transformation.

TransformF(FsMatrixF)

Transforms a page object using a specified transformation matrix. The transformation matrix is defined by the six parameters: a, b, c, d, e, and f. This method modifies the object's position and size on the page.

public void TransformF(FsMatrixF matrix)

Parameters

matrix FsMatrixF