PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
PDF::Element Class Reference

Represents a PDF content element. More...

#include <pdfsdk/cxx/element.h>

Inheritance diagram for PDF::Element:

Public Member Functions

Element Copy () const
 
bool Equals (const Element &that) const
 
PDEElementType GetElementType () const
 
RectF GetBBox () const
 
Quad GetQuad () const
 
Clip GetClip () const
 
void SetClip (const Clip &clip)
 
GState GetGState () const
 
void SetGState (const GState &gstate)
 
Matrix GetMatrix () const
 
void SetMatrix (const Matrix &matrix)
 
bool HitTest (const PointF &point) const
 
PDAtom GetContainerTag () const
 
void SetContainerTag (PDAtom tag)
 
Object GetContainerDict () const
 
void SetContainerDict (const Object &dict)
 
Content GetContainerContent () const
 
OCMembership GetContainerOCMembership () const
 
PDEPaintOp GetPathPaintOp () const
 
void SetPathPaintOp (PDEPaintOp paintOp)
 
size_t GetPathNumSegments () const
 
PDEPathSegment GetPathSegment (size_t index) const
 
void PathAddSegment (const PDEPathSegment &segment)
 
void PathMoveTo (const PointF &to)
 
void PathLineTo (const PointF &to)
 
void PathCurveTo (const PointF &c0, const PointF &c1, const PointF &to)
 
void PathVCurveTo (const PointF &c0, const PointF &to)
 
void PathYCurveTo (const PointF &c1, const PointF &to)
 
void PathRect (const RectF &rect)
 
void PathClose ()
 
void PathRemoveSegment (size_t index)
 
size_t GetTextNumRuns () const
 
TextRun GetTextRun (size_t index) const
 
TextRun GetTextRunAtPoint (const PointF &pagePt) const
 
void TextInsertRun (size_t index, const TextRun &run)
 
void TextRemoveRun (size_t index)
 
void TextSplitRun (size_t itemIndex, size_t charIndex)
 
bool GetTextKnockout () const
 
void SetTextKnockout (bool knockout)
 
XObject GetXObject () const
 
void SetXObject (const XObject &xobject)
 
Shading GetShading () const
 
void SetShading (const Shading &shading)
 
bool IsImage () const
 
PDEImageAttrs GetImageAttrs () const
 
 Element (PDEElement handle, bool adopt=false) noexcept
 
 Element (const Element &rhs) noexcept
 
Elementoperator= (const Element &rhs) noexcept
 
 Element (Element &&rhs) noexcept
 
Elementoperator= (Element &&rhs) noexcept
 

Static Public Member Functions

static Element CreateContainer (PDAtom tag, const Object &dict)
 
static Element CreatePath ()
 
static Element CreateText ()
 
static Element CreateXObject (const XObject &xobject)
 
static Element CreateShading (const Shading &shading)
 
static Element LayoutText (const Document &doc, const std::wstring &text, const RectF &box, const PDFontInfo &fontInfo, float fontSize, PDColorValue fontColor, PDETextAlign alignment)
 

Detailed Description

Represents a PDF content element.

ISO 32000-2:2020 - 8.2 Graphics objects

Member Function Documentation

◆ Copy()

Element PDF::Element::Copy ( ) const

Creates a copy of the element.

Returns
The copied element.

◆ CreateContainer()

static Element PDF::Element::CreateContainer ( PDAtom tag,
const Object & dict )
static

Creates a container element with the specified tag and dictionary.

Parameters
tagThe tag of the container element.
dictThe dictionary associated with the container element.
Returns
The created container element.

◆ CreatePath()

static Element PDF::Element::CreatePath ( )
static

Creates a path element.

Returns
The created path element.

◆ CreateShading()

static Element PDF::Element::CreateShading ( const Shading & shading)
static

Creates a shading element with the specified shading.

Parameters
shadingThe shading associated with the element.
Returns
The created shading element.

◆ CreateText()

static Element PDF::Element::CreateText ( )
static

Creates a text element.

Returns
The created text element.

◆ CreateXObject()

static Element PDF::Element::CreateXObject ( const XObject & xobject)
static

Creates an XObject element with the specified XObject.

Parameters
xobjectThe XObject associated with the element.
Returns
The created XObject element.

◆ Equals()

bool PDF::Element::Equals ( const Element & that) const

Checks if the element is equal to another element.

Parameters
thatThe element to compare.
Returns
True if the elements are equal, false otherwise.

◆ GetBBox()

RectF PDF::Element::GetBBox ( ) const

Gets the bounding box of the element.

Returns
The bounding box of the element.

◆ GetClip()

Clip PDF::Element::GetClip ( ) const

Gets the clip associated with the element.

Returns
The clip associated with the element.

◆ GetContainerContent()

Content PDF::Element::GetContainerContent ( ) const

Gets the content of the container element.

Returns
The content of the container element.

◆ GetContainerDict()

Object PDF::Element::GetContainerDict ( ) const

Gets the dictionary associated with the container element.

Returns
The dictionary associated with the container element.

◆ GetContainerOCMembership()

OCMembership PDF::Element::GetContainerOCMembership ( ) const

Gets the optional content membership of the container element.

Returns
The optional content membership of the container element.

◆ GetContainerTag()

PDAtom PDF::Element::GetContainerTag ( ) const

Gets the tag of the container element.

Returns
The tag of the container element.

◆ GetElementType()

PDEElementType PDF::Element::GetElementType ( ) const

Gets the type of the element.

Returns
The type of the element.

◆ GetGState()

GState PDF::Element::GetGState ( ) const

Gets the graphics state of the element.

Returns
The graphics state of the element.

◆ GetImageAttrs()

PDEImageAttrs PDF::Element::GetImageAttrs ( ) const

Gets the image attributes of the element.

Returns
The image attributes of the element.

◆ GetMatrix()

Matrix PDF::Element::GetMatrix ( ) const

Gets the matrix of the element.

Returns
The matrix of the element.

◆ GetPathNumSegments()

size_t PDF::Element::GetPathNumSegments ( ) const

Gets the number of segments in the path element.

Returns
The number of segments in the path element.

◆ GetPathPaintOp()

PDEPaintOp PDF::Element::GetPathPaintOp ( ) const

Gets the paint operation of the path element.

Returns
The paint operation of the path element.

◆ GetPathSegment()

PDEPathSegment PDF::Element::GetPathSegment ( size_t index) const

Gets the path segment at the specified index.

Parameters
indexThe index of the path segment.
Returns
The path segment at the specified index.

◆ GetQuad()

Quad PDF::Element::GetQuad ( ) const

Gets the quad associated with the element.

Returns
The quad associated with the element.

◆ GetShading()

Shading PDF::Element::GetShading ( ) const

Gets the shading associated with the element.

Returns
The shading associated with the element.

◆ GetTextKnockout()

bool PDF::Element::GetTextKnockout ( ) const

Gets the knockout state of the text element.

Returns
True if the text element has knockout, false otherwise.

◆ GetTextNumRuns()

size_t PDF::Element::GetTextNumRuns ( ) const

Gets the number of text runs in the element.

Returns
The number of text runs.

◆ GetTextRun()

TextRun PDF::Element::GetTextRun ( size_t index) const

Gets the text run at the specified index.

Parameters
indexThe index of the text run.
Returns
The text run at the specified index.

◆ GetTextRunAtPoint()

TextRun PDF::Element::GetTextRunAtPoint ( const PointF & pagePt) const

Gets the text run at the specified point on the page.

Parameters
pagePtThe point on the page.
Returns
The text run at the specified point.

◆ GetXObject()

XObject PDF::Element::GetXObject ( ) const

Gets the XObject associated with the element.

Returns
The XObject associated with the element.

◆ HitTest()

bool PDF::Element::HitTest ( const PointF & point) const

Performs a hit test on the element at the specified point.

Parameters
pointThe point to test.
Returns
True if the point is within the element, false otherwise.

◆ IsImage()

bool PDF::Element::IsImage ( ) const

Checks if the element is an image.

Returns
True if the element is an image, false otherwise.

◆ LayoutText()

static Element PDF::Element::LayoutText ( const Document & doc,
const std::wstring & text,
const RectF & box,
const PDFontInfo & fontInfo,
float fontSize,
PDColorValue fontColor,
PDETextAlign alignment )
static

Layouts text within a specified box using the given font information.

Parameters
docThe document containing the text.
textThe text to layout.
boxThe bounding box for the text.
fontInfoThe font information.
fontSizeThe font size.
fontColorThe font color.
alignmentThe text alignment.
Returns
The layouted text element.

◆ PathAddSegment()

void PDF::Element::PathAddSegment ( const PDEPathSegment & segment)

Adds a path segment to the path element.

Parameters
segmentThe path segment to add.

◆ PathClose()

void PDF::Element::PathClose ( )

Closes the current subpath of the path element.

◆ PathCurveTo()

void PDF::Element::PathCurveTo ( const PointF & c0,
const PointF & c1,
const PointF & to )

Adds a cubic Bezier curve segment to the path element.

Parameters
c0The first control point.
c1The second control point.
toThe end point of the curve.

◆ PathLineTo()

void PDF::Element::PathLineTo ( const PointF & to)

Adds a line segment from the current point of the path element to the specified point.

Parameters
toThe point to draw the line to.

◆ PathMoveTo()

void PDF::Element::PathMoveTo ( const PointF & to)

Moves the current point of the path element to the specified point.

Parameters
toThe point to move to.

◆ PathRect()

void PDF::Element::PathRect ( const RectF & rect)

Adds a rectangle segment to the path element.

Parameters
rectThe rectangle to add.

◆ PathRemoveSegment()

void PDF::Element::PathRemoveSegment ( size_t index)

Removes the path segment at the specified index.

Parameters
indexThe index of the path segment to remove.

◆ PathVCurveTo()

void PDF::Element::PathVCurveTo ( const PointF & c0,
const PointF & to )

Adds a vertical cubic Bezier curve segment to the path element.

Parameters
c0The control point.
toThe end point of the curve.

◆ PathYCurveTo()

void PDF::Element::PathYCurveTo ( const PointF & c1,
const PointF & to )

Adds a cubic Bezier curve segment to the path element in the Y direction.

Parameters
c1The first control point in the Y direction.
toThe end point of the curve in the Y direction.

◆ SetClip()

void PDF::Element::SetClip ( const Clip & clip)

Sets the clip for the element.

Parameters
clipThe clip to set.

◆ SetContainerDict()

void PDF::Element::SetContainerDict ( const Object & dict)

Sets the dictionary for the container element.

Parameters
dictThe dictionary to set.

◆ SetContainerTag()

void PDF::Element::SetContainerTag ( PDAtom tag)

Sets the tag for the container element.

Parameters
tagThe tag to set.

◆ SetGState()

void PDF::Element::SetGState ( const GState & gstate)

Sets the graphics state for the element.

Parameters
gstateThe graphics state to set.

◆ SetMatrix()

void PDF::Element::SetMatrix ( const Matrix & matrix)

Sets the matrix for the element.

Parameters
matrixThe matrix to set.

◆ SetPathPaintOp()

void PDF::Element::SetPathPaintOp ( PDEPaintOp paintOp)

Sets the paint operation for the path element.

Parameters
paintOpThe paint operation to set.

◆ SetShading()

void PDF::Element::SetShading ( const Shading & shading)

Sets the shading for the element.

Parameters
shadingThe shading to set.

◆ SetTextKnockout()

void PDF::Element::SetTextKnockout ( bool knockout)

Sets the knockout state of the text element.

Parameters
knockoutThe knockout state to set.

◆ SetXObject()

void PDF::Element::SetXObject ( const XObject & xobject)

Sets the XObject for the element.

Parameters
xobjectThe XObject to set.

◆ TextInsertRun()

void PDF::Element::TextInsertRun ( size_t index,
const TextRun & run )

Inserts a text run at the specified index.

Parameters
indexThe index to insert the text run.
runThe text run to insert.

◆ TextRemoveRun()

void PDF::Element::TextRemoveRun ( size_t index)

Removes the text run at the specified index.

Parameters
indexThe index of the text run to remove.

◆ TextSplitRun()

void PDF::Element::TextSplitRun ( size_t itemIndex,
size_t charIndex )

Splits the text run at the specified item and character index.

Parameters
itemIndexThe index of the text run.
charIndexThe index of the character within the text run.

The documentation for this class was generated from the following file: