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-2021 by PDFTron Systems 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 
29 class Page
30 {
31 public:
32 
44  Page (SDF::Obj page_dict = 0);
45 
46  Page (const Page& p);
47  Page& operator= (const Page& p);
48 
54  bool IsValid() const;
55 
61  int GetIndex() const;
62 
96  enum Box
97  {
104  };
105 
115  Rect GetBox(Box type) const;
116 
125  void SetBox(Box type, const Rect& box) const;
126 
134  Rect GetCropBox() const;
135 
148  void SetCropBox(const Rect& box);
149 
161  Rect GetMediaBox() const;
162 
175  void SetMediaBox(const Rect& box);
176 
183  Rect GetVisibleContentBox() const;
184 
188  enum Rotate
189  {
194  };
195 
203  static Rotate AddRotations(Rotate r0, Rotate r1);
204 
212  static Rotate SubtractRotations(Rotate r0, Rotate r1);
213 
220  static int RotationToDegree(Rotate r);
221 
229  static Rotate DegreeToRotation(int r);
230 
234  Rotate GetRotation() const;
235 
242  void SetRotation(Rotate angle);
243 
250  double GetPageWidth(Box box_type = e_crop);
251 
258  double GetPageHeight(Box box_type = e_crop);
259 
275  Common::Matrix2D GetDefaultMatrix(bool flip_y = false, Box box_type = e_crop, Rotate angle = e_0) const;
276 
284  SDF::Obj GetAnnots() const;
285 
292  UInt32 GetNumAnnots() const;
293 
303  Annot GetAnnot(UInt32 index) const;
304 
306  {
307  e_action_trigger_page_open = 11, //Triggered when the page is opened and shall be executed after such an action
308  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
309  };
310 
318 
327  void AnnotInsert(UInt32 pos, Annot& annot);
328 
333  void AnnotPushBack(Annot& annot);
334 
339  void AnnotPushFront(Annot& annot);
340 
346  void AnnotRemove(Annot& annot);
347 
353  void AnnotRemove(UInt32 index);
354 
367  void Scale(double scale);
368 
382  void FlattenField(class Field field_to_flatten);
383 
387  bool HasTransition() const;
388 
396  double GetUserUnitSize() const;
397 
407  void SetUserUnitSize(double unit_size);
408 
413  SDF::Obj GetResourceDict () const;
414 
418  SDF::Obj GetContents () const;
419 
425  SDF::Obj GetSDFObj () const;
426 
445  SDF::Obj FindInheritedAttribute (const char* attrib) const;
446 
447 
451  operator bool () { return IsValid();}
452 
456  SDF::Obj GetThumb() const;
457 
458 
459 // @cond PRIVATE_DOC
460 #ifndef SWIGHIDDEN
461  Page(TRN_Page impl);
462  TRN_Page mp_page;
463 #endif
464 // @endcond
465 };
466 
467 
468  }; // namespace PDF
469 }; // namespace pdftron
470 #include <Impl/Page.inl>
471 
472 #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