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  {
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  {
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 
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 
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
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 AnnotInsertWithTagging(UInt32 pos, Annot &annot, SDF::Obj &tag_parent, const TaggingOptions &options)
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