- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Element.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFElement
6 #define PDFTRON_H_CPPPDFElement
7
8 #include <SDF/Obj.h>
9 #include <PDF/GState.h>
10 #include <PDF/Rect.h>
11 #include <PDF/CharData.h>
12 #include <PDF/PathData.h>
13 #include <PDF/Struct/SElement.h>
14 #include <C/PDF/TRN_Element.h>
15
16 namespace pdftron {
17 namespace PDF {
18
19
32 class Element
33 {
34 public:
35 // Common Methods ---------------------------------------------------------------
36
37 enum Type
38 {
39 e_null, // undefined element type
40 e_path, // path object
41 e_text_begin, // marks the beginning of a text container
42 e_text, // text object within a text container
43 e_text_new_line, // indicates the start of the new text line
44 e_text_end, // marks the end of text container
45 e_image, // image XObject
46 e_inline_image, // inline image object
47 e_shading, // shading object
48 e_form, // a form XObject
49 e_group_begin, // push graphics state operator (q)
50 e_group_end, // pop graphics state operator (Q)
51 e_marked_content_begin, // marks the beginning of marked content sequence (BMC, BDC)
52 e_marked_content_end, // marks the end of marked content sequence (EMC)
53 e_marked_content_point // designate a marked-content point (MP, DP)
54 };
55
56 Element();
57 Element(const Element& c);
58 Element& operator=(const Element&c);
59 operator bool () { return mp_elem!=0;}
60
64 Type GetType();
65
69 GState GetGState();
70
75 Common::Matrix2D GetCTM();
76
97 Rect GetBBox();
98
99 #ifndef SWIG
100 bool GetBBox(Rect& out_bbox);
101 #endif
102
108 Struct::SElement GetParentStructElement();
109
117 int GetStructMCID();
118
129 bool IsOCVisible();
130
131 // Path Element (e_path) Get Methods --------------------------------------------
132
137 bool IsClippingPath();
138
142 bool IsStroked();
143
147 bool IsFilled();
148
166 bool IsWindingFill();
167
172 bool IsClipWindingFill();
173
179 PathData GetPathData() const;
180
181 // Path Element (e_path) Set Methods --------------------------------------------
182
187 void SetPathData(const PathData& data);
188
193 void SetPathClip(bool clip);
194
199 void SetPathStroke(bool stroke);
200
205 void SetPathFill(bool fill);
206
212 void SetWindingFill(bool winding_rule);
213
219 void SetClipWindingFill(bool winding_rule);
220
221 // XObject Element (e_image or e_form_begin) Methods ----------------------------
222
226 SDF::Obj GetXObject();
227
228
229 // Image (e_image and e_inline_image) Element Methods ---------------------------
230
234 Filters::Filter GetImageData() const;
235
239 int GetImageDataSize() const;
240
252 #if defined(_WIN32)
253 Gdiplus::Bitmap* GetBitmap() const;
254 #endif
255
262 ColorSpace GetImageColorSpace() const;
263
267 int GetImageWidth() const;
268
272 int GetImageHeight() const;
273
282 SDF::Obj GetDecodeArray() const;
283
289 int GetBitsPerComponent() const;
290
294 int GetComponentNum() const;
295
296
300 bool IsImageMask() const;
301
305 bool IsImageInterpolate() const;
306
314 SDF::Obj GetMask() const;
315
319 GState::RenderingIntent GetImageRenderingIntent() const;
320
321 // Text Element (e_text) Get Methods --------------------------------------------
322
340 UString GetTextString();
341
356 #ifdef SWIG
357 std::vector<unsigned char> GetTextData();
358 #else
359 const UChar* GetTextData();
360 #endif
361
365 UInt32 GetTextDataSize();
366
370 Common::Matrix2D GetTextMatrix();
371
402 CharIterator GetCharIterator();
403
418 double GetTextLength();
419
429 double GetPosAdjustment();
430
431 // Text New Line Element (e_text_new_line) Methods ------------------------------
432
440 Point GetNewTextLineOffset();
441
442 #ifndef SWIG
443 void GetNewTextLineOffset(double& out_x, double& out_y);
444 #endif
445
452 void SetNewTextLineOffset(double dx, double dy);
453
454
455 // Text Element (e_text and e_text_new_line) Methods ----------------------------
456
462 bool HasTextMatrix();
463
464
465 // Text Element (e_text) Set Methods --------------------------------------------
466
472 void SetTextData(const UChar* buf_text_data, int text_data_size);
473
479 void SetTextMatrix(Common::Matrix2D& mtx);
480
500 void SetTextMatrix(double a, double b, double c, double d, double h, double v);
501
508 void SetPosAdjustment(double adjust);
509
519 void UpdateTextMetrics();
520
521
522 // Shading Element (e_shading) Methods ------------------------------------------
523
527 Shading GetShading();
528
529 // Marked Content Elements
530 // (e_marked_content_begin and e_marked_content_point) Methods ------------------
531
540 SDF::Obj GetMCPropertyDict();
541
546 SDF::Obj GetMCTag();
547
548 ~Element() {}
549
550
551 // @cond PRIVATE_DOC
552 #ifndef SWIGHIDDEN
553 Element(TRN_Element impl);
554 TRN_Element mp_elem;
555 #endif
556 // @endcond
557 };
558
559
560 #include <Impl/Element.inl>
561
562 }; // namespace PDF
563 }; // namespace pdftron
564
565 #endif // PDFTRON_H_CPPPDFElement
pdftron::PDF::Struct::SElement
Definition: SElement.h:22
pdftron::PDF::Element::IsImageInterpolate
bool IsImageInterpolate() const
pdftron::PDF::Element::GetCharIterator
CharIterator GetCharIterator()
pdftron::PDF::Element::SetTextMatrix
void SetTextMatrix(Common::Matrix2D &mtx)
pdftron::PDF::Element::SetPathClip
void SetPathClip(bool clip)
pdftron::PDF::Element::SetPathStroke
void SetPathStroke(bool stroke)
pdftron::PDF::Element::GetStructMCID
int GetStructMCID()
pdftron::PDF::Element::UpdateTextMetrics
void UpdateTextMetrics()
pdftron::PDF::Element::GetImageData
Filters::Filter GetImageData() const
pdftron::PDF::Element::e_image
Definition: Element.h:45
pdftron::PDF::Element::GetTextLength
double GetTextLength()
pdftron::PDF::Element::SetPathFill
void SetPathFill(bool fill)
pdftron::PDF::Element::IsWindingFill
bool IsWindingFill()
pdftron::PDF::Element::e_marked_content_end
Definition: Element.h:52
pdftron::PDF::Element::e_inline_image
Definition: Element.h:46
pdftron::PDF::Element::e_group_end
Definition: Element.h:50
pdftron::PDF::Element::SetPathData
void SetPathData(const PathData &data)
pdftron::PDF::ColorSpace
Definition: ColorSpace.h:138
pdftron::PDF::Element::Element
Element()
pdftron::PDF::Element::GetMCPropertyDict
SDF::Obj GetMCPropertyDict()
pdftron::PDF::Element::IsStroked
bool IsStroked()
pdftron::PDF::Shading
Definition: Shading.h:60
pdftron::PDF::Element::IsImageMask
bool IsImageMask() const
pdftron::PDF::GState
Definition: GState.h:26
pdftron::PDF::Element::GetTextMatrix
Common::Matrix2D GetTextMatrix()
pdftron::PDF::Element::~Element
~Element()
Definition: Element.h:548
pdftron::PDF::Element::GetImageRenderingIntent
GState::RenderingIntent GetImageRenderingIntent() const
pdftron::PDF::Element::e_marked_content_begin
Definition: Element.h:51
pdftron::PDF::Element::GetBitsPerComponent
int GetBitsPerComponent() const
PathData.h
pdftron::PDF::Element::IsOCVisible
bool IsOCVisible()
pdftron::PDF::Element::GetPosAdjustment
double GetPosAdjustment()
pdftron::PDF::Element::GetGState
GState GetGState()
pdftron::PDF::Element::IsClippingPath
bool IsClippingPath()
pdftron::PDF::Element::SetWindingFill
void SetWindingFill(bool winding_rule)
CharData.h
pdftron::PDF::Rect
Definition: Rect.h:28
pdftron::PDF::Element::GetImageHeight
int GetImageHeight() const
pdftron::PDF::Point
Definition: Point.h:12
pdftron::PDF::Element::e_shading
Definition: Element.h:47
pdftron::PDF::Element::e_form
Definition: Element.h:48
pdftron::PDF::Element::GetCTM
Common::Matrix2D GetCTM()
pdftron::PDF::Element::GetImageColorSpace
ColorSpace GetImageColorSpace() const
pdftron::PDF::Element::GetType
Type GetType()
pdftron::PDF::Element::GetNewTextLineOffset
Point GetNewTextLineOffset()
pdftron::PDF::Element::GetShading
Shading GetShading()
pdftron::UInt32
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
pdftron::PDF::PathData
Definition: PathData.h:19
pdftron::PDF::Element::HasTextMatrix
bool HasTextMatrix()
pdftron::PDF::Element::GetXObject
SDF::Obj GetXObject()
pdftron::Common::Matrix2D
Definition: Matrix2D.h:103
pdftron::PDF::Element::GetImageWidth
int GetImageWidth() const
pdftron::PDF::Element::GetTextString
UString GetTextString()
pdftron::PDF::Element::GetTextData
const UChar * GetTextData()
pdftron::PDF::GState::RenderingIntent
RenderingIntent
Definition: GState.h:290
Obj.h
pdftron::UChar
TRN_UChar UChar
Definition: BasicTypes.h:12
pdftron::PDF::Element::Type
Type
Definition: Element.h:37
pdftron::PDF::Element::GetDecodeArray
SDF::Obj GetDecodeArray() const
pdftron::PDF::Element::GetBitmap
Gdiplus::Bitmap * GetBitmap() const
pdftron::PDF::Element::e_text_end
Definition: Element.h:44
pdftron::PDF::Element::GetComponentNum
int GetComponentNum() const
pdftron::PDF::Element::GetMCTag
SDF::Obj GetMCTag()
pdftron::PDF::Element::e_group_begin
Definition: Element.h:49
GState.h
pdftron::PDF::Element::GetPathData
PathData GetPathData() const
pdftron::Filters::Filter
Definition: Filter.h:45
pdftron::PDF::Element::GetParentStructElement
Struct::SElement GetParentStructElement()
pdftron::PDF::Element::SetNewTextLineOffset
void SetNewTextLineOffset(double dx, double dy)
pdftron::PDF::Element::e_path
Definition: Element.h:40
pdftron::PDF::Element::e_marked_content_point
Definition: Element.h:53
pdftron::PDF::Element::IsClipWindingFill
bool IsClipWindingFill()
pdftron::Common::Iterator
Definition: Iterator.h:20
pdftron::PDF::Element::e_null
Definition: Element.h:39
pdftron::PDF::Element
Definition: Element.h:32
SElement.h
pdftron::PDF::Element::operator=
Element & operator=(const Element &c)
pdftron::PDF::Element::e_text_new_line
Definition: Element.h:43
Rect.h
pdftron::PDF::Element::e_text_begin
Definition: Element.h:41
pdftron::SDF::Obj
Definition: Obj.h:40
pdftron::PDF::Element::GetImageDataSize
int GetImageDataSize() const
pdftron::PDF::Element::SetClipWindingFill
void SetClipWindingFill(bool winding_rule)
pdftron::PDF::Element::GetBBox
Rect GetBBox()
pdftron::PDF::Element::GetMask
SDF::Obj GetMask() const
pdftron::PDF::Element::IsFilled
bool IsFilled()
pdftron::PDF::Element::SetPosAdjustment
void SetPosAdjustment(double adjust)
pdftron::PDF::Element::e_text
Definition: Element.h:42
pdftron::UString
Definition: UString.h:27
pdftron::PDF::Element::SetTextData
void SetTextData(const UChar *buf_text_data, int text_data_size)
pdftron::PDF::Element::GetTextDataSize
UInt32 GetTextDataSize()