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-2018 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 
91  enum Box
92  {
98  };
99 
109  Rect GetBox(Box type) const;
110 
119  void SetBox(Box type, const Rect& box) const;
120 
128  Rect GetCropBox() const;
129 
142  void SetCropBox(const Rect& box);
143 
155  Rect GetMediaBox() const;
156 
169  void SetMediaBox(const Rect& box);
170 
177  Rect GetVisibleContentBox() const;
178 
182  enum Rotate
183  {
188  };
189 
197  static Rotate AddRotations(Rotate r0, Rotate r1);
198 
206  static Rotate SubtractRotations(Rotate r0, Rotate r1);
207 
214  static int RotationToDegree(Rotate r);
215 
223  static Rotate DegreeToRotation(int r);
224 
228  Rotate GetRotation() const;
229 
236  void SetRotation(Rotate angle);
237 
244  double GetPageWidth(Box box_type = e_crop);
245 
252  double GetPageHeight(Box box_type = e_crop);
253 
269  Common::Matrix2D GetDefaultMatrix(bool flip_y = false, Box box_type = e_crop, Rotate angle = e_0) const;
270 
278  SDF::Obj GetAnnots() const;
279 
286  UInt32 GetNumAnnots() const;
287 
297  Annot GetAnnot(UInt32 index) const;
298 
300  {
301  e_action_trigger_page_open = 11, //Triggered when the page is opened and shall be executed after such an action
302  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
303  };
304 
312 
321  void AnnotInsert(UInt32 pos, Annot& annot);
322 
327  void AnnotPushBack(Annot& annot);
328 
333  void AnnotPushFront(Annot& annot);
334 
340  void AnnotRemove(Annot& annot);
341 
347  void AnnotRemove(UInt32 index);
348 
361  void Scale(double scale);
362 
376  void FlattenField(class Field field_to_flatten);
377 
381  bool HasTransition() const;
382 
390  double GetUserUnitSize() const;
391 
401  void SetUserUnitSize(double unit_size);
402 
407  SDF::Obj GetResourceDict () const;
408 
412  SDF::Obj GetContents () const;
413 
419  SDF::Obj GetSDFObj () const;
420 
439  SDF::Obj FindInheritedAttribute (const char* attrib) const;
440 
441 
445  operator bool () { return IsValid();}
446 
450  SDF::Obj GetThumb() const;
451 
452 
454 #ifndef SWIGHIDDEN
455  Page(TRN_Page impl);
456  TRN_Page mp_page;
457 #endif
458 };
460 
461 
462  }; // namespace PDF
463 }; // namespace pdftron
464 #include <Impl/Page.inl>
465 
466 #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

© 2002-2014 PDFTron Systems Inc.