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
56 static Element CreatePath();
57
65 static Element CreateText();
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
257 bool IsVisibleInContext(const OCContext& context) const;
258
263 PDAtom GetPlaceTag() const;
264
269 void SetPlaceTag(PDAtom tag);
270
278
285 void SetPlaceDict(const Object& dict);
286
292 PDEPaintOp GetPathPaintOp() const;
293
299 void SetPathPaintOp(PDEPaintOp paintOp);
300
307 size_t GetPathNumSegments() const;
308
322 PDEPathSegment GetPathSegment(size_t index) const;
323
332 void PathAddSegment(const PDEPathSegment& segment);
333
342 void PathMoveTo(const PointF& to);
343
352 void PathLineTo(const PointF& to);
353
363 void PathCurveTo(const PointF& c0, const PointF& c1, const PointF& to);
364
374 void PathVCurveTo(const PointF& c0, const PointF& to);
375
384 void PathYCurveTo(const PointF& c1, const PointF& to);
385
393 void PathRect(const RectF& rect);
394
404 void PathClose();
405
410 void PathRemoveSegment(size_t index);
411
422 size_t GetTextNumRuns() const;
423
436 TextRun GetTextRun(size_t index) const;
437
449 TextRun GetTextRunAtPoint(const PointF& pagePt) const;
450
463 void TextInsertRun(size_t index, const TextRun& run);
464
477 void TextRemoveRun(size_t index);
478
493 void TextSplitRun(size_t itemIndex, size_t charIndex);
494
507 bool GetTextKnockout() const;
508
522 void SetTextKnockout(bool knockout);
523
532
537 void SetXObject(const XObject& xobject);
538
544
549 void SetShading(const Shading& shading);
550
556 bool IsImage() const;
557
563
569
570 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Element, PDEElement)
571};
572
573} // namespace PDF
574
575#include "element_impl.inl"
576
577#endif // PDFSDK_CXX_PDF_ELEMENT_H_INCLUDED_
Represents a clipping path in a PDF document.
Definition clip.h:33
Represents a color space in a PDF document.
Definition color_space.h:43
Represents a content array.
Definition content.h:29
Represents a PDF document.
Definition document.h:27
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.
ColorSpace GetImageColorSpace() const
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 SetPlaceDict(const Object &dict)
Sets the dictionary (marked-content property list) associated with this marked-content point element.
PDAtom GetPlaceTag() const
Gets the tag (name object) of a marked-content point element.
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.
void SetPlaceTag(PDAtom tag)
Sets the tag (name object) of a marked-content point 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.
bool IsVisibleInContext(const OCContext &context) const
Checks whether this element is visible in a given optional content (OC) context.
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.
Object GetPlaceDict() const
Gets the dictionary (marked-content property list) associated with this marked-content point 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
A runtime optional-content visibility context for a document.
Definition optional_content.h:288
Optional content membership dictionary (OCMD).
Definition optional_content.h:96
Represents a PDF object.
Definition object.h:25
Represents a shading in a PDF document.
Definition shading.h:18
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:837
PDEElementType
Specifies a marked-content sequence of graphics objects (Container), a marked-content point in the co...
Definition content.h:214
Definition content.h:618
Definition content.h:357
Definition math.h:1276
Definition math.h:154
Definition math.h:1033
Definition math.h:752
Specifies the font information.
Definition fonts.h:36