My Project
fs_pdfpage.h
Go to the documentation of this file.
1 
15 #ifndef FS_PDFPAGE_H_
16 #define FS_PDFPAGE_H_
17 
18 #include "common/fs_common.h"
19 #include "common/fs_image.h"
20 #include "pdf/annots/fs_annot.h"
23 
29 namespace foxit {
33 namespace pdf {
34 // forward declaration
35 namespace interform {
36 class Control;
37 } // namespace interform
38 class PDFDoc;
39 class Signature;
40 
59 class GraphicsObjects : public Base {
60  public:
61  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
62  explicit GraphicsObjects(FS_HANDLE handle = NULL);
64  virtual ~GraphicsObjects();
65 
71  GraphicsObjects(const GraphicsObjects& other);
72 
81 
89  bool IsEmpty() const;
90 
98  bool operator==(const GraphicsObjects& other) const;
99 
107  bool operator!=(const GraphicsObjects& other) const;
108 
144 
161 
181 
191 
208  POSITION InsertGraphicsObject(POSITION position_insert_after, graphics::GraphicsObject* graphics_object);
209 
225  bool RemoveGraphicsObject(graphics::GraphicsObject* graphics_object);
226 
243 
259  bool GenerateContent();
260 };
261 
307 class PDFPage FS_FINAL : public GraphicsObjects {
308  public:
314  typedef enum _ParseFlags {
319  } ParseFlags;
320 
326  typedef enum _CalcMarginMode {
331  } CalcMarginMode;
332 
338  typedef enum _FlattenOptions {
345  } FlattenOptions;
346 
352  typedef enum _BoxType {
372  e_ArtBox = 3,
378  } BoxType;
379 
385  typedef enum _Size {
391  e_SizeA2 = 3,
393  e_SizeA3 = 4,
395  e_SizeA4 = 5,
397  e_SizeA5 = 6,
399  e_SizeA6 = 7,
401  e_SizeB2 = 8,
403  e_SizeB3 = 9,
405  e_SizeB4 = 10,
407  e_SizeB5 = 11,
409  e_SizeB6 = 12
410  } Size;
411 
420  PDFPage(const PDFDoc& document, objects::PDFDictionary* page_dict);
421 
422  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
423  explicit PDFPage(FS_HANDLE handle = NULL);
424 
430  explicit PDFPage(const foxit::pdf::GraphicsObjects& other);
431 
433  virtual ~PDFPage();
434 
440  PDFDoc GetDocument() const;
447 
454  bool IsParsed() const;
481  bool is_reparse = false);
482 
488  int GetIndex() const;
494  float GetHeight() const;
500  float GetWidth() const;
515 
529  Matrix GetDisplayMatrix(int left, int top, int width, int height, common::Rotation rotate);
530 
547 
553  int GetAnnotCount();
554 
563  annots::Annot GetAnnot(int index);
564 
579  annots::Annot GetAnnotAtPoint(const PointF& position, float tolerance);
580 
599  annots::Annot GetAnnotAtDevicePoint(const PointF& position, float tolerance, const Matrix* matrix = NULL);
600 
650  annots::Annot AddAnnot(annots::Annot::Type type, const RectF& rect);
651 
666  bool RemoveAnnot(const annots::Annot& annot);
667 
683  virtual void MoveAnnotToFirst(const annots::Annot& annot);
684 
700  virtual void MoveAnnotToLast(const annots::Annot& annot);
701 
717  virtual void MoveAnnotToPrev(const annots::Annot& annot);
718 
734  virtual void MoveAnnotToNext(const annots::Annot& annot);
735 
744  bool HasTransparency();
745 
779  bool Flatten(bool for_display, uint32 options = PDFPage::e_FlattenAll);
780 
806  bool SetAnnotGroup(const annots::MarkupArray& annot_array, int header_index);
807 
822  Signature AddSignature(const RectF& rect);
823 
839  Signature AddSignature(const RectF& rect, const foxit::WString& field_name);
840 
849  bool HasWatermark();
850 
858  bool RemoveAllWatermarks();
859 
868  void SetRotation(common::Rotation rotate);
869 
884  void SetSize(float width, float height);
900 
910  void SetBox(BoxType box_type, const RectF& box);
911 
920  RectF GetBox(BoxType box_type);
921 
930  float GetUserUnitSize() const;
931 
943  void SetUserUnitSize(float user_unit);
944 
958  bool Transform(const Matrix& matrix, bool need_transform_clip_path);
959 
970  void SetClipRect(const RectF& clip_rect);
971 
983  void SetThumbnail(const common::Bitmap& thumbnail);
984 
998  graphics::GraphicsObject* GetGraphicsObjectAtPoint(const PointF& point, float tolerance,
1000 
1014  graphics::GraphicsObjectArray GetGraphicsObjectsAtPoint(const PointF& point, float tolerance,
1016 
1041  bool AddImage(const common::Image& image, int frame_index, const PointF& position, float width, float height,
1042  bool auto_generate_content = true);
1043 
1064  bool AddImageFromFilePath(const char* file_path, const PointF& position, float width, float height,
1065  bool auto_generate_content = true);
1066 
1087  bool AddImageFromFilePath(const wchar_t* file_path, const PointF& position, float width, float height,
1088  bool auto_generate_content = true);
1089 
1097  objects::PDFArray* GetAnnots() const;
1098 
1107 
1117 
1125  objects::PDFStream* GetThumb() const;
1126 
1138  objects::PDFObject* GetInheritedAttribute(const char* attruibute_name) const;
1139 };
1140 } // namespace pdf
1141 } // namespace foxit
1142 #endif // FS_PDFPAGE_H_
1143 
Matrix GetDisplayMatrix(int left, int top, int width, int height, common::Rotation rotate)
Get the display matrix of PDF page, from PDF coordinate system to targeted device coordinate system.
PDFPage(const PDFDoc &document, objects::PDFDictionary *page_dict)
Constructor, from a PDF dictionary which represents a PDF page and the PDF document which contains th...
bool RemoveAnnot(const annots::Annot &annot)
Remove an annotation.
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:216
Definition: fs_pdfobject.h:575
Crop Box for page boundary.
Definition: fs_pdfpage.h:362
bool RemoveAllWatermarks()
Remove all watermarks.
POSITION GetFirstGraphicsObjectPosition(graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll) const
Get the position of first graphics object in graphics object list, based on type filter.
virtual void MoveAnnotToLast(const annots::Annot &annot)
Change specified annotation to be the last one of all annotations.
Definition: fs_annot.h:749
bool Transform(const Matrix &matrix, bool need_transform_clip_path)
Transform a PDF page, including annotations and form fields on the page.
Calculate margin by detecting paths or images.
Definition: fs_pdfpage.h:330
RectF GetBox(BoxType box_type)
Get page box.
Bleed Box for page boundary.
Definition: fs_pdfpage.h:377
Size
Enumeration for page size type.
Definition: fs_pdfpage.h:385
Definition: fs_common.h:385
FX_POSITION POSITION
A value used to denote the position of an element in a collection.
Definition: fs_basictypes.h:208
Page size: B2.
Definition: fs_pdfpage.h:401
Type
Enumeration for PDF graphics object type.
Definition: fs_pdfgraphicsobject.h:291
bool RemoveGraphicsObjectByPosition(POSITION position)
Remove a graphics object by position.
Art Box for page boundary.
Definition: fs_pdfpage.h:372
float GetHeight() const
Get the page height.
bool RemoveGraphicsObject(graphics::GraphicsObject *graphics_object)
Remove a graphics object.
bool operator==(const GraphicsObjects &other) const
Equal operator.
Page size: A5.
Definition: fs_pdfpage.h:397
Header file for common definitions and classes.
Page size: legal.
Definition: fs_pdfpage.h:389
bool HasWatermark()
Check whether the current page has any watermark (not including Foxit PDF SDK trial watermark).
Definition: fx_basic.h:1287
int GetAnnotCount()
Get the count of annotations.
Trim Box for page boundary.
Definition: fs_pdfpage.h:367
void SetUserUnitSize(float user_unit)
Set the user unit.
PDFDoc GetDocument() const
Get the PDF document, to which current PDF page belongs.
annots::Annot AddAnnot(annots::Annot::Type type, const RectF &rect)
Add an annotation to PDF page.
Flatten a PDF page without annotations.
Definition: fs_pdfpage.h:342
Definition: fs_pdfobject.h:55
objects::PDFDictionary * GetResources() const
Get the PDF dictionary of "Resources".
bool SetAnnotGroup(const annots::MarkupArray &annot_array, int header_index)
Group all the input markup annotations together.
Page size: B4.
Definition: fs_pdfpage.h:405
bool HasTransparency()
Check whether current PDF page has transparency or not.
bool IsParsed() const
Check if current page has been parsed or not.
graphics::GraphicsObjectArray GetGraphicsObjectsAtPoint(const PointF &point, float tolerance, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll)
Get all the graphics objects in specified point, with specified type filter.
objects::PDFObject * GetInheritedAttribute(const char *attruibute_name) const
Get the PDF object for specified attribute which may be inherited from the ancestor node in the page ...
POSITION GetLastGraphicsObjectPosition(graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll) const
Get the position of last graphics object in graphics object list, based on type filter.
float GetWidth() const
Get the page width.
ParseFlags
Enumeration for parsing flags used for PDF page.
Definition: fs_pdfpage.h:314
GraphicsObjects & operator=(const GraphicsObjects &other)
Assign operator.
annots::Annot GetAnnot(int index)
Get an annotation by index.
virtual void MoveAnnotToNext(const annots::Annot &annot)
Exchange the indexes of current annotation and its next annotation.
Media Box for page boundary.
Definition: fs_pdfpage.h:357
objects::PDFStream * GetThumb() const
Get the PDF stream of "Thumb".
bool AddImage(const common::Image &image, int frame_index, const PointF &position, float width, float height, bool auto_generate_content=true)
Add an image to current page.
common::Progressive StartParse(uint32 flags=PDFPage::e_ParsePageNormal, common::PauseCallback *pause=0, bool is_reparse=false)
Start to parse current page.
POSITION InsertGraphicsObject(POSITION position_insert_after, graphics::GraphicsObject *graphics_object)
Insert a graphics object after the specified position.
Page size: B6.
Definition: fs_pdfpage.h:409
Definition: fs_signature.h:84
Definition: fx_coordinates.h:30
annots::Annot GetAnnotAtDevicePoint(const PointF &position, float tolerance, const Matrix *matrix=0)
Get the annotation at a specified position, in device coordination system.
Rotation
Enumeration for rotation.
Definition: fs_common.h:221
Definition: fs_pdfgraphicsobject.h:154
virtual ~PDFPage()
Destructor.
Calculate margin according to bounding box of all contents.
Definition: fs_pdfpage.h:328
FlattenOptions
Enumeration for flatten options.
Definition: fs_pdfpage.h:338
Header file for PDF object related definitions and classes.
Page size: B3.
Definition: fs_pdfpage.h:403
Represents all graphics object types, only used as filter.
Definition: fs_pdfgraphicsobject.h:293
Foxit namespace.
Definition: fs_connectedpdf.h:26
Parsing flag for text-only mode.
Definition: fs_pdfpage.h:318
Flatten a PDF page without form controls.
Definition: fs_pdfpage.h:344
Page size: A4.
Definition: fs_pdfpage.h:395
bool Flatten(bool for_display, uint32 options=PDFPage::e_FlattenAll)
Flatten current PDF page: annotations or form fields may be made to be a part of the page contents ac...
Signature AddSignature(const RectF &rect)
Add a signature to PDF page.
graphics::GraphicsObject * GetGraphicsObject(POSITION position) const
Get the graphics object by position in graphics object list.
Definition: fx_basic.h:3690
Header file for image and bitmap related definitions and classes.
int GetIndex() const
Get page index.
Definition: fs_pdfobject.h:763
objects::PDFObject * GetContents() const
Get the PDF object of "Contents".
void SetRotation(common::Rotation rotate)
Set page rotation.
Page size: A6.
Definition: fs_pdfpage.h:399
bool operator!=(const GraphicsObjects &other) const
Not equal operator.
#define NULL
The null-pointer value.
Definition: fx_system.h:773
objects::PDFArray * GetAnnots() const
Get the PDF array of "Annots".
virtual void MoveAnnotToFirst(const annots::Annot &annot)
Change specified annotation to be the first one of all annotations.
Definition: fx_coordinates.h:763
Definition: fs_pdfdoc.h:338
Definition: fs_pdfpage.h:307
Flatten all contents of a PDF page.
Definition: fs_pdfpage.h:340
Definition: fs_image.h:426
annots::Annot GetAnnotAtPoint(const PointF &position, float tolerance)
Get the annotation at a specified position, in PDF coordinate system.
Header file for PDF graphics object related definitions and classes.
Definition: fs_annot.h:1544
Type
Enumeration for PDF annotation type.
Definition: fs_annot.h:756
float GetUserUnitSize() const
Get the user unit.
void SetThumbnail(const common::Bitmap &thumbnail)
Set page thumbnail.
RectF CalcContentBBox(CalcMarginMode mode)
Calculate the content area of PDF page.
Definition: fx_coordinates.h:1053
void SetSize(float width, float height)
Set page width and height.
Header file for annotation related definitions and classes.
POSITION GetPrevGraphicsObjectPosition(POSITION position, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll) const
Get the position of previous graphics object in graphics object list, based on type filter and specif...
void SetBox(BoxType box_type, const RectF &box)
Set page box.
POSITION GetNextGraphicsObjectPosition(POSITION position, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll) const
Get the position of next graphics object in graphics object list, based on type filter and specified ...
Definition: fs_pdfobject.h:385
CalcMarginMode
Enumeration for calculating margin mode.
Definition: fs_pdfpage.h:326
WIDE STRING CLASS.
Definition: fx_string.h:1470
Page size: B5.
Definition: fs_pdfpage.h:407
Definition: fs_image.h:36
virtual void MoveAnnotToPrev(const annots::Annot &annot)
Exchange the indexes of current annotation and its previous annotation.
bool IsEmpty() const
Check whether current object is empty or not.
Page size: A2.
Definition: fs_pdfpage.h:391
graphics::GraphicsObject * GetGraphicsObjectAtPoint(const PointF &point, float tolerance, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll) const
Get the topmost graphics object in specified point, with specified type filter.
void SetClipRect(const RectF &clip_rect)
Set clip rectangle for all graphics objects on current PDF page.
bool AddImageFromFilePath(const char *file_path, const PointF &position, float width, float height, bool auto_generate_content=true)
Add an image to current page from file path.
common::Rotation GetRotation() const
Get the page rotation.
BoxType
Enumeration for page box type.
Definition: fs_pdfpage.h:352
objects::PDFDictionary * GetDict() const
Get the page dictionary.
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:198
Parsing flag for normal mode, which means to parse all the contents in a PDF page.
Definition: fs_pdfpage.h:316
Definition: fs_basictypes.h:342
Page size: letter.
Definition: fs_pdfpage.h:387
virtual ~GraphicsObjects()
Destructor.
Definition: fs_pdfpage.h:59
bool GenerateContent()
Generate contents of current graphics objects.
Page size: A3.
Definition: fs_pdfpage.h:393
common::Bitmap LoadThumbnail()
Load the thumbnail bitmap.

Foxit Software Corporation Logo
@2019 Foxit Software Incorporated. All rights reserved.