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 
30 class Page
31 {
32 public:
33 
45  Page (SDF::Obj page_dict = 0);
46 
47  Page (const Page& p);
48  Page& operator= (const Page& p);
49 
55  bool IsValid() const;
56 
62  int GetIndex() const;
63 
97  enum Box
98  {
105  };
106 
116  Rect GetBox(Box type) const;
117 
126  void SetBox(Box type, const Rect& box) const;
127 
135  Rect GetCropBox() const;
136 
149  void SetCropBox(const Rect& box);
150 
162  Rect GetMediaBox() const;
163 
176  void SetMediaBox(const Rect& box);
177 
184  Rect GetVisibleContentBox() const;
185 
189  enum Rotate
190  {
195  };
196 
204  static Rotate AddRotations(Rotate r0, Rotate r1);
205 
213  static Rotate SubtractRotations(Rotate r0, Rotate r1);
214 
221  static int RotationToDegree(Rotate r);
222 
230  static Rotate DegreeToRotation(int r);
231 
235  Rotate GetRotation() const;
236 
243  void SetRotation(Rotate angle);
244 
251  double GetPageWidth(Box box_type = e_crop);
252 
259  double GetPageHeight(Box box_type = e_crop);
260 
276  Common::Matrix2D GetDefaultMatrix(bool flip_y = false, Box box_type = e_crop, Rotate angle = e_0) const;
277 
285  SDF::Obj GetAnnots() const;
286 
293  UInt32 GetNumAnnots() const;
294 
304  Annot GetAnnot(UInt32 index) const;
305 
307  {
308  e_action_trigger_page_open = 11, //Triggered when the page is opened and shall be executed after such an action
309  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
310  };
311 
319 
328  void AnnotInsert(UInt32 pos, Annot& annot);
329 
334  void AnnotPushBack(Annot& annot);
335 
340  void AnnotPushFront(Annot& annot);
341 
347  void AnnotRemove(Annot& annot);
348 
354  void AnnotRemove(UInt32 index);
355 
368  void Scale(double scale);
369 
383  void FlattenField(class Field field_to_flatten);
384 
388  bool HasTransition() const;
389 
397  double GetUserUnitSize() const;
398 
408  void SetUserUnitSize(double unit_size);
409 
414  SDF::Obj GetResourceDict () const;
415 
419  SDF::Obj GetContents () const;
420 
426  SDF::Obj GetSDFObj () const;
427 
446  SDF::Obj FindInheritedAttribute (const char* attrib) const;
447 
448 
452  operator bool () { return IsValid();}
453 
457  SDF::Obj GetThumb() const;
458 
459 
460 // @cond PRIVATE_DOC
461 #ifndef SWIGHIDDEN
462  Page(TRN_Page impl);
463  TRN_Page mp_page;
464 #endif
465 // @endcond
466 };
467 
468 
469  }; // namespace PDF
470 }; // namespace pdftron
471 #include <Impl/Page.inl>
472 
473 #endif // PDFTRON_H_CPPPDFPage
double GetPageWidth(Box box_type=e_crop)
SDF::Obj FindInheritedAttribute(const char *attrib) const
void AnnotRemove(Annot &annot)
bool IsValid() const
UInt32 GetNumAnnots() const
void SetMediaBox(const Rect &box)
int GetIndex() const
double GetUserUnitSize() const
SDF::Obj GetThumb() const
Common::Matrix2D GetDefaultMatrix(bool flip_y=false, Box box_type=e_crop, Rotate angle=e_0) const
SDF::Obj GetAnnots() const
static int RotationToDegree(Rotate r)
void AnnotPushBack(Annot &annot)
void FlattenField(class Field field_to_flatten)
SDF::Obj GetTriggerAction(Page::ActionTriggerEvent trigger)
void Scale(double scale)
Page & operator=(const Page &p)
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
void SetCropBox(const Rect &box)
void SetBox(Box type, const Rect &box) const
void AnnotPushFront(Annot &annot)
static Rotate AddRotations(Rotate r0, Rotate r1)
void SetRotation(Rotate angle)
bool HasTransition() const
Rect GetMediaBox() const
Rect GetCropBox() const
double GetPageHeight(Box box_type=e_crop)
SDF::Obj GetSDFObj() const
static Rotate SubtractRotations(Rotate r0, Rotate r1)
Rect GetBox(Box type) const
Page(SDF::Obj page_dict=0)
Rotate GetRotation() const
void SetUserUnitSize(double unit_size)
void AnnotInsert(UInt32 pos, Annot &annot)
SDF::Obj GetResourceDict() const
Annot GetAnnot(UInt32 index) const
static Rotate DegreeToRotation(int r)
Rect GetVisibleContentBox() const
SDF::Obj GetContents() const