PDF SDK Documentation

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

Loading...
Searching...
No Matches
element.h
1// Copyright (c) 2009-2025 Avanquest Software. All rights reserved.
2
3#ifndef PDFSDK_CXX_PDF_ELEMENT_H_INCLUDED_
4#define PDFSDK_CXX_PDF_ELEMENT_H_INCLUDED_
5
7#include <pdfsdk/cxx/math.h>
8
9#include "forward_declarations.h"
10#include "wrapper_base.h"
11
12namespace PDF {
13
29class Element : public detail::RefCountedHandle<PDEElement> {
30public:
47 static Element CreateContainer(PDAtom tag, const Object& dict);
48
57
66
74 static Element CreateXObject(const XObject& xobject);
75
82 static Element CreateShading(const Shading& shading);
83
95 static Element LayoutText(const Document& doc,
96 const std::wstring& text,
97 const RectF& box,
98 const PDFontInfo& fontInfo,
99 float fontSize,
100 PDColorValue fontColor,
101 PDETextAlign alignment);
102
107 Element Copy() const;
108
114 bool Equals(const Element& that) const;
115
121
127 RectF GetBBox() const;
128
139 Quad GetQuad() const;
140
147 Clip GetClip() const;
148
155 void SetClip(const Clip& clip);
156
162
168 void SetGState(const GState& gstate);
169
179
189 void SetMatrix(const Matrix& matrix);
190
199 bool HitTest(const PointF& point) const;
200
206 PDAtom GetContainerTag() const;
207
213 void SetContainerTag(PDAtom tag);
214
222
229 void SetContainerDict(const Object& dict);
230
237
248
254 PDEPaintOp GetPathPaintOp() const;
255
261 void SetPathPaintOp(PDEPaintOp paintOp);
262
269 size_t GetPathNumSegments() const;
270
284 PDEPathSegment GetPathSegment(size_t index) const;
285
294 void PathAddSegment(const PDEPathSegment& segment);
295
304 void PathMoveTo(const PointF& to);
305
314 void PathLineTo(const PointF& to);
315
325 void PathCurveTo(const PointF& c0, const PointF& c1, const PointF& to);
326
336 void PathVCurveTo(const PointF& c0, const PointF& to);
337
346 void PathYCurveTo(const PointF& c1, const PointF& to);
347
355 void PathRect(const RectF& rect);
356
366 void PathClose();
367
372 void PathRemoveSegment(size_t index);
373
384 size_t GetTextNumRuns() const;
385
398 TextRun GetTextRun(size_t index) const;
399
411 TextRun GetTextRunAtPoint(const PointF& pagePt) const;
412
425 void TextInsertRun(size_t index, const TextRun& run);
426
439 void TextRemoveRun(size_t index);
440
455 void TextSplitRun(size_t itemIndex, size_t charIndex);
456
469 bool GetTextKnockout() const;
470
484 void SetTextKnockout(bool knockout);
485
494
499 void SetXObject(const XObject& xobject);
500
506
511 void SetShading(const Shading& shading);
512
518 bool IsImage() const;
519
525
526 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Element, PDEElement)
527};
528
529} // namespace PDF
530
531#include "element_impl.inl"
532
533#endif // PDFSDK_CXX_PDF_ELEMENT_H_INCLUDED_
Represents a clipping path in a PDF document.
Definition clip.h:33
Represents a content array.
Definition content.h:29
Represents a PDF document.
Definition document.h:22
Represents an element of the content array.
Definition element.h:29
PDEImageAttrs GetImageAttrs() const
Gets the image attributes of the content array element.
void PathVCurveTo(const PointF &c0, const PointF &to)
Appends a cubic Bezier curve to the current point of the path. The current point is the first control...
PDAtom GetContainerTag() const
Gets the tag (name object) of a content array element, that represents a marked-content sequence (a c...
bool IsImage() const
Checks if the content array element has an image resource associated with it.
TextRun GetTextRun(size_t index) const
Gets the text run at the specified index inside the content array element.
RectF GetBBox() const
Gets the bounding box of a content array element that represents a text graphics object.
Quad GetQuad() const
Gets the quadrilateral that encloses a content array element.
void TextInsertRun(size_t index, const TextRun &run)
Inserts a text run at the specified index inside the content array element.
void SetPathPaintOp(PDEPaintOp paintOp)
Sets the path-painting operator of the content array element. See 8.5.3 Path-painting operators.
void PathRemoveSegment(size_t index)
Removes the path segment at the specified index.
void PathAddSegment(const PDEPathSegment &segment)
Adds a path segment to the path graphics object.
void SetMatrix(const Matrix &matrix)
Sets the current transformation matrix, held within the graphics state of a content array element.
void SetTextKnockout(bool knockout)
Sets the knockout state of the text inside the content array element.
void SetXObject(const XObject &xobject)
Adds an XObject resource to a content array element.
Element Copy() const
Creates a copy of the content array element.
OCMembership GetContainerOCMembership() const
Gets the optional content membership dictionary of the container content array element.
XObject GetXObject() const
Gets the XObject resource associated with the content array element.
void SetShading(const Shading &shading)
Sets the shading resource for the content array element.
static Element CreateXObject(const XObject &xobject)
Creates a content array element that represents a graphics object of the external object (XObject) ty...
Shading GetShading() const
Gets the shading resource associated with the content array element.
void TextSplitRun(size_t itemIndex, size_t charIndex)
Splits the text run at the specified item and character index inside the content array element.
Content GetContainerContent() const
Gets the content array element that represents a marked-content sequence (container) within the conte...
void SetContainerTag(PDAtom tag)
Sets the tag (name object) of a content array element, that represents a marked-content sequence (a c...
PDEElementType GetElementType() const
Gets the type of a content array element.
void SetGState(const GState &gstate)
Sets the graphics state of a content array element.
Matrix GetMatrix() const
Gets the current transformation matrix, held within the graphics state of a content array element.
static Element CreateContainer(PDAtom tag, const Object &dict)
Creates a content array element of type container that represents a marked-content sequence within th...
void TextRemoveRun(size_t index)
Removes the text run at the specified index from inside the content array element.
static Element CreateShading(const Shading &shading)
Creates a content array element that represents a shading graphics object.
static Element CreatePath()
Creates a content array element that represents a path graphics object.
bool GetTextKnockout() const
Gets the knockout state of the text inside the content array element.
size_t GetTextNumRuns() const
Gets the number of text runs inside the content array element.
Object GetContainerDict() const
Gets the dictionary (marked-content property list) associated with this container element.
static Element LayoutText(const Document &doc, const std::wstring &text, const RectF &box, const PDFontInfo &fontInfo, float fontSize, PDColorValue fontColor, PDETextAlign alignment)
Creates a content array element which is a text graphics object.
GState GetGState() const
Gets the graphics state of a content array element.
bool Equals(const Element &that) const
Checks if two content array elements are equal.
void SetClip(const Clip &clip)
Sets the clipping path associated with the graphics state of a content array element.
void PathLineTo(const PointF &to)
Appends a line segment from the current point of the path graphics object to the specified point.
void PathYCurveTo(const PointF &c1, const PointF &to)
Appends a cubic Bezier curve to the current point of the path.
static Element CreateText()
Creates a content array element that represents a text graphics object.
PDEPaintOp GetPathPaintOp() const
Gets the path-painting operator of the content array element. See 8.5.3 Path-painting operators.
void PathCurveTo(const PointF &c0, const PointF &c1, const PointF &to)
Appends a cubic Bezier curve to the current point of the path.
Clip GetClip() const
Gets the clipping path associated with the graphics state of a content array element.
size_t GetPathNumSegments() const
Gets the number of segments that a path graphics object is made of. The element is of type kPDEElemen...
void PathRect(const RectF &rect)
Appends a rectangle segment to the current point of the path.
TextRun GetTextRunAtPoint(const PointF &pagePt) const
Gets the text run at the specified point on the page.
void PathClose()
Closes the current subpath at the current point of the path.
PDEPathSegment GetPathSegment(size_t index) const
Gets the path segment from a path graphics object at the specified index.
void PathMoveTo(const PointF &to)
Moves the current path graphics object to the specified point.
bool HitTest(const PointF &point) const
Checks whether the point is located within the content array element.
void SetContainerDict(const Object &dict)
Sets the dictionary (marked-content property list) associated with this container element.
Represents the graphics state of a PDF document.
Definition gstate.h:19
Optional content membership.
Definition optional_content.h:68
Represents a PDF object.
Definition object.h:20
Represents a shading in a PDF document.
Definition shading.h:17
Represents a text run in a PDF document.
Definition text_run.h:19
Represents an XObject in a PDF document.
Definition xobject.h:22
Content API.
PDETextAlign
Specifies the alignment in the inline-progression direction, of text and other content within lines o...
Definition content.h:747
PDEElementType
Specifies a marked-content sequence of graphics objects (Container), a marked-content point in the co...
Definition content.h:214
Definition content.h:569
Definition content.h:308
Definition math.h:1271
Definition math.h:154
Definition math.h:1029
Definition math.h:749
Definition fonts.h:32