Loading...
Searching...
No Matches
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
CharData.h
GState.h
Obj.h
PathData.h
Rect.h
SElement.h
pdftron::Common::Matrix2D
Definition Matrix2D.h:104
pdftron::Filters::Filter
Definition Filter.h:46
pdftron::PDF::ColorSpace
Definition ColorSpace.h:139
pdftron::PDF::Element::IsStroked
bool IsStroked()
pdftron::PDF::Element::IsOCVisible
bool IsOCVisible()
pdftron::PDF::Element::GetStructMCID
int GetStructMCID()
pdftron::PDF::Element::GetShading
Shading GetShading()
pdftron::PDF::Element::SetPathStroke
void SetPathStroke(bool stroke)
pdftron::PDF::Element::SetNewTextLineOffset
void SetNewTextLineOffset(double dx, double dy)
pdftron::PDF::Element::IsImageInterpolate
bool IsImageInterpolate() const
pdftron::PDF::Element::GetImageData
Filters::Filter GetImageData() const
pdftron::PDF::Element::GetTextLength
double GetTextLength()
pdftron::PDF::Element::GetTextData
const UChar * GetTextData()
pdftron::PDF::Element::GetTextDataSize
UInt32 GetTextDataSize()
pdftron::PDF::Element::IsWindingFill
bool IsWindingFill()
pdftron::PDF::Element::GetBBox
bool GetBBox(Rect &out_bbox)
pdftron::PDF::Element::~Element
~Element()
Definition Element.h:548
pdftron::PDF::Element::Type
Type
Definition Element.h:38
pdftron::PDF::Element::e_marked_content_begin
@ e_marked_content_begin
Definition Element.h:51
pdftron::PDF::Element::e_text_begin
@ e_text_begin
Definition Element.h:41
pdftron::PDF::Element::e_marked_content_point
@ e_marked_content_point
Definition Element.h:53
pdftron::PDF::Element::e_group_end
@ e_group_end
Definition Element.h:50
pdftron::PDF::Element::e_group_begin
@ e_group_begin
Definition Element.h:49
pdftron::PDF::Element::e_text
@ e_text
Definition Element.h:42
pdftron::PDF::Element::e_image
@ e_image
Definition Element.h:45
pdftron::PDF::Element::e_path
@ e_path
Definition Element.h:40
pdftron::PDF::Element::e_null
@ e_null
Definition Element.h:39
pdftron::PDF::Element::e_inline_image
@ e_inline_image
Definition Element.h:46
pdftron::PDF::Element::e_marked_content_end
@ e_marked_content_end
Definition Element.h:52
pdftron::PDF::Element::e_text_new_line
@ e_text_new_line
Definition Element.h:43
pdftron::PDF::Element::e_shading
@ e_shading
Definition Element.h:47
pdftron::PDF::Element::e_form
@ e_form
Definition Element.h:48
pdftron::PDF::Element::e_text_end
@ e_text_end
Definition Element.h:44
pdftron::PDF::Element::GetImageWidth
int GetImageWidth() const
pdftron::PDF::Element::GetMCPropertyDict
SDF::Obj GetMCPropertyDict()
pdftron::PDF::Element::Element
Element(const Element &c)
pdftron::PDF::Element::GetNewTextLineOffset
void GetNewTextLineOffset(double &out_x, double &out_y)
pdftron::PDF::Element::GetMask
SDF::Obj GetMask() const
pdftron::PDF::Element::GetImageDataSize
int GetImageDataSize() const
pdftron::PDF::Element::UpdateTextMetrics
void UpdateTextMetrics()
pdftron::PDF::Element::HasTextMatrix
bool HasTextMatrix()
pdftron::PDF::Element::GetTextString
UString GetTextString()
pdftron::PDF::Element::IsClipWindingFill
bool IsClipWindingFill()
pdftron::PDF::Element::GetBBox
Rect GetBBox()
pdftron::PDF::Element::SetWindingFill
void SetWindingFill(bool winding_rule)
pdftron::PDF::Element::GetImageRenderingIntent
GState::RenderingIntent GetImageRenderingIntent() const
pdftron::PDF::Element::SetClipWindingFill
void SetClipWindingFill(bool winding_rule)
pdftron::PDF::Element::GetComponentNum
int GetComponentNum() const
pdftron::PDF::Element::GetCharIterator
CharIterator GetCharIterator()
pdftron::PDF::Element::SetPathData
void SetPathData(const PathData &data)
pdftron::PDF::Element::GetParentStructElement
Struct::SElement GetParentStructElement()
pdftron::PDF::Element::GetPathData
PathData GetPathData() const
pdftron::PDF::Element::GetBitsPerComponent
int GetBitsPerComponent() const
pdftron::PDF::Element::Element
Element()
pdftron::PDF::Element::GetXObject
SDF::Obj GetXObject()
pdftron::PDF::Element::GetMCTag
SDF::Obj GetMCTag()
pdftron::PDF::Element::operator=
Element & operator=(const Element &c)
pdftron::PDF::Element::GetDecodeArray
SDF::Obj GetDecodeArray() const
pdftron::PDF::Element::GetGState
GState GetGState()
pdftron::PDF::Element::GetType
Type GetType()
pdftron::PDF::Element::IsFilled
bool IsFilled()
pdftron::PDF::Element::SetTextMatrix
void SetTextMatrix(double a, double b, double c, double d, double h, double v)
pdftron::PDF::Element::SetPathClip
void SetPathClip(bool clip)
pdftron::PDF::Element::GetPosAdjustment
double GetPosAdjustment()
pdftron::PDF::Element::GetCTM
Common::Matrix2D GetCTM()
pdftron::PDF::Element::SetTextData
void SetTextData(const UChar *buf_text_data, int text_data_size)
pdftron::PDF::Element::GetNewTextLineOffset
Point GetNewTextLineOffset()
pdftron::PDF::Element::SetPosAdjustment
void SetPosAdjustment(double adjust)
pdftron::PDF::Element::IsClippingPath
bool IsClippingPath()
pdftron::PDF::Element::GetImageHeight
int GetImageHeight() const
pdftron::PDF::Element::SetTextMatrix
void SetTextMatrix(Common::Matrix2D &mtx)
pdftron::PDF::Element::SetPathFill
void SetPathFill(bool fill)
pdftron::PDF::Element::IsImageMask
bool IsImageMask() const
pdftron::PDF::Element::GetImageColorSpace
ColorSpace GetImageColorSpace() const
pdftron::PDF::Element::GetTextMatrix
Common::Matrix2D GetTextMatrix()
pdftron::PDF::GState
Definition GState.h:27
pdftron::PDF::GState::RenderingIntent
RenderingIntent
Definition GState.h:291
pdftron::PDF::PathData
Definition PathData.h:20
pdftron::PDF::Point
Definition Point.h:13
pdftron::PDF::Rect
Definition Rect.h:29
pdftron::PDF::Shading
Definition Shading.h:61
pdftron::PDF::Struct::SElement
Definition SElement.h:23
pdftron::SDF::Obj
Definition Obj.h:41
pdftron::UString
Definition UString.h:28
pdftron::PDF
Definition Action.h:15
pdftron::PDF::CharIterator
Common::Iterator< TRN_CharData > CharIterator
Definition CharData.h:41
pdftron
Definition BasicTypes.h:10
pdftron::UInt32
TRN_UInt32 UInt32
Definition BasicTypes.h:13
pdftron::UChar
TRN_UChar UChar
Definition BasicTypes.h:12