- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Page.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_CPPPDFPage
6 #define PDFTRON_H_CPPPDFPage
7
8 #include <PDF/Rect.h>
9 #include <SDF/Obj.h>
10 #include <C/PDF/TRN_Page.h>
11 #include <Common/Matrix2D.h>
12
13 namespace pdftron {
14 namespace PDF {
15
16 class Annot; // Forward declaration
17 class Field;
18 class TaggingOptions;
19
31 class Page
32 {
33 public:
34
46 Page (SDF::Obj page_dict = 0);
47
48 Page (const Page& p);
49 Page& operator= (const Page& p);
50
56 bool IsValid() const;
57
63 int GetIndex() const;
64
98 enum Box
99 {
100 e_media,
101 e_crop,
102 e_bleed,
103 e_trim,
104 e_art,
105 e_user_crop
106 };
107
117 Rect GetBox(Box type) const;
118
127 void SetBox(Box type, const Rect& box) const;
128
136 Rect GetCropBox() const;
137
150 void SetCropBox(const Rect& box);
151
163 Rect GetMediaBox() const;
164
177 void SetMediaBox(const Rect& box);
178
185 Rect GetVisibleContentBox() const;
186
190 enum Rotate
191 {
192 e_0,
193 e_90,
194 e_180,
195 e_270
196 };
197
205 static Rotate AddRotations(Rotate r0, Rotate r1);
206
214 static Rotate SubtractRotations(Rotate r0, Rotate r1);
215
222 static int RotationToDegree(Rotate r);
223
231 static Rotate DegreeToRotation(int r);
232
236 Rotate GetRotation() const;
237
244 void SetRotation(Rotate angle);
245
252 double GetPageWidth(Box box_type = e_crop);
253
260 double GetPageHeight(Box box_type = e_crop);
261
277 Common::Matrix2D GetDefaultMatrix(bool flip_y = false, Box box_type = e_crop, Rotate angle = e_0) const;
278
286 SDF::Obj GetAnnots() const;
287
294 UInt32 GetNumAnnots() const;
295
305 Annot GetAnnot(UInt32 index) const;
306
307 enum ActionTriggerEvent
308 {
309 e_action_trigger_page_open = 11, //Triggered when the page is opened and shall be executed after such an action
310 e_action_trigger_page_close = 12 //Triggered when the page is closed, This action applies to the page being closed and shall be executed before any other page is opened
311 };
312
319 SDF::Obj GetTriggerAction(Page::ActionTriggerEvent trigger);
320
329 void AnnotInsert(UInt32 pos, Annot& annot);
330
342 void AnnotInsertWithTagging(UInt32 pos, Annot& annot, SDF::Obj& tag_parent, const TaggingOptions& options);
343
344
349 void AnnotPushBack(Annot& annot);
350
355 void AnnotPushFront(Annot& annot);
356
362 void AnnotRemove(Annot& annot);
363
369 void AnnotRemove(UInt32 index);
370
383 void Scale(double scale);
384
398 void FlattenField(class Field field_to_flatten);
399
403 bool HasTransition() const;
404
412 double GetUserUnitSize() const;
413
423 void SetUserUnitSize(double unit_size);
424
429 SDF::Obj GetResourceDict () const;
430
434 SDF::Obj GetContents () const;
435
441 SDF::Obj GetSDFObj () const;
442
461 SDF::Obj FindInheritedAttribute (const char* attrib) const;
462
463
467 operator bool () { return IsValid();}
468
472 SDF::Obj GetThumb() const;
473
474
475 // @cond PRIVATE_DOC
476 #ifndef SWIGHIDDEN
477 Page(TRN_Page impl);
478 TRN_Page mp_page;
479 #endif
480 // @endcond
481 };
482
483
484 }; // namespace PDF
485 }; // namespace pdftron
486 #include <Impl/Page.inl>
487
488 #endif // PDFTRON_H_CPPPDFPage
pdftron::PDF::Page::e_90
Definition: Page.h:193
pdftron::PDF::Page::GetPageWidth
double GetPageWidth(Box box_type=e_crop)
pdftron::PDF::Page::FindInheritedAttribute
SDF::Obj FindInheritedAttribute(const char *attrib) const
pdftron::PDF::Page::AnnotRemove
void AnnotRemove(Annot &annot)
pdftron::PDF::Page::e_media
Definition: Page.h:100
pdftron::PDF::Page::e_bleed
Definition: Page.h:102
pdftron::PDF::Page::IsValid
bool IsValid() const
pdftron::PDF::Page::GetNumAnnots
UInt32 GetNumAnnots() const
pdftron::PDF::Page::SetMediaBox
void SetMediaBox(const Rect &box)
pdftron::PDF::Page::e_0
Definition: Page.h:192
pdftron::PDF::Page::e_user_crop
Definition: Page.h:105
pdftron::PDF::Page::GetIndex
int GetIndex() const
pdftron::PDF::Page::e_trim
Definition: Page.h:103
pdftron::PDF::Page::GetUserUnitSize
double GetUserUnitSize() const
pdftron::PDF::Page::GetThumb
SDF::Obj GetThumb() const
pdftron::PDF::Page::GetDefaultMatrix
Common::Matrix2D GetDefaultMatrix(bool flip_y=false, Box box_type=e_crop, Rotate angle=e_0) const
Matrix2D.h
pdftron::PDF::Page::GetAnnots
SDF::Obj GetAnnots() const
pdftron::PDF::Page::RotationToDegree
static int RotationToDegree(Rotate r)
pdftron::PDF::Page::AnnotPushBack
void AnnotPushBack(Annot &annot)
pdftron::PDF::Page::FlattenField
void FlattenField(class Field field_to_flatten)
pdftron::PDF::Page::GetTriggerAction
SDF::Obj GetTriggerAction(Page::ActionTriggerEvent trigger)
pdftron::PDF::Page::e_action_trigger_page_open
Definition: Page.h:309
pdftron::PDF::Rect
Definition: Rect.h:28
pdftron::PDF::Page::Scale
void Scale(double scale)
pdftron::PDF::Page::operator=
Page & operator=(const Page &p)
pdftron::PDF::Page::e_crop
Definition: Page.h:101
pdftron::PDF::Page::Rotate
Rotate
Definition: Page.h:190
pdftron::PDF::Page::Box
Box
Definition: Page.h:98
pdftron::PDF::TaggingOptions
Definition: TaggingOptions.h:9
pdftron::UInt32
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
pdftron::Common::Matrix2D
Definition: Matrix2D.h:103
pdftron::PDF::Page::AnnotInsertWithTagging
void AnnotInsertWithTagging(UInt32 pos, Annot &annot, SDF::Obj &tag_parent, const TaggingOptions &options)
pdftron::PDF::Page::SetCropBox
void SetCropBox(const Rect &box)
pdftron::PDF::Page::SetBox
void SetBox(Box type, const Rect &box) const
Obj.h
pdftron::PDF::Page::AnnotPushFront
void AnnotPushFront(Annot &annot)
pdftron::PDF::Page::AddRotations
static Rotate AddRotations(Rotate r0, Rotate r1)
pdftron::PDF::Page::SetRotation
void SetRotation(Rotate angle)
pdftron::PDF::Page::HasTransition
bool HasTransition() const
pdftron::PDF::Page::e_180
Definition: Page.h:194
pdftron::PDF::Page::e_art
Definition: Page.h:104
pdftron::PDF::Page::GetMediaBox
Rect GetMediaBox() const
pdftron::PDF::Page::GetCropBox
Rect GetCropBox() const
pdftron::PDF::Page::GetPageHeight
double GetPageHeight(Box box_type=e_crop)
pdftron::PDF::Page::GetSDFObj
SDF::Obj GetSDFObj() const
pdftron::PDF::Page
Definition: Page.h:31
pdftron::PDF::Page::SubtractRotations
static Rotate SubtractRotations(Rotate r0, Rotate r1)
pdftron::PDF::Page::e_270
Definition: Page.h:195
pdftron::PDF::Annot
Definition: Annot.h:33
pdftron::PDF::Page::GetBox
Rect GetBox(Box type) const
pdftron::PDF::Page::Page
Page(SDF::Obj page_dict=0)
pdftron::PDF::Field
Definition: Field.h:69
pdftron::PDF::Page::e_action_trigger_page_close
Definition: Page.h:310
pdftron::PDF::Page::GetRotation
Rotate GetRotation() const
pdftron::PDF::Page::SetUserUnitSize
void SetUserUnitSize(double unit_size)
Rect.h
pdftron::PDF::Page::AnnotInsert
void AnnotInsert(UInt32 pos, Annot &annot)
pdftron::PDF::Page::ActionTriggerEvent
ActionTriggerEvent
Definition: Page.h:307
pdftron::SDF::Obj
Definition: Obj.h:40
pdftron::PDF::Page::GetResourceDict
SDF::Obj GetResourceDict() const
pdftron::PDF::Page::GetAnnot
Annot GetAnnot(UInt32 index) const
pdftron::PDF::Page::DegreeToRotation
static Rotate DegreeToRotation(int r)
pdftron::PDF::Page::GetVisibleContentBox
Rect GetVisibleContentBox() const
pdftron::PDF::Page::GetContents
SDF::Obj GetContents() const