Foxit PDF SDK

Public Types | Public Member Functions | List of all members
foxit::pdf::PDFPage Class Reference
Inheritance diagram for foxit::pdf::PDFPage:

## Public Types
enum | BoxType { e_MediaBox = 0, e_CropBox = 1, e_TrimBox = 2, e_ArtBox = 3, e_BleedBox = 4 }
| Enumeration for page box type. More...
enum | CalcMarginMode { e_CalcContentsBox = 0, e_CalcDetection = 1 }
| Enumeration for calculating margin mode. More...
enum | FlattenOptions { e_FlattenAll = 0, e_FlattenNoAnnot = 0x0001, e_FlattenNoFormControl = 0x0002 }
| Enumeration for flatten options. More...
enum | ParseFlags { e_ParsePageNormal = 0x0000, e_ParsePageTextOnly = 0x0001 }
| Enumeration for parsing flags used for PDF page. More...
enum | Size { e_SizeLetter = 1, e_SizeLegal = 2, e_SizeA2 = 3, e_SizeA3 = 4, e_SizeA4 = 5, e_SizeA5 = 6, e_SizeA6 = 7, e_SizeB2 = 8, e_SizeB3 = 9, e_SizeB4 = 10, e_SizeB5 = 11, e_SizeB6 = 12 }
| Enumeration for page size type. More...
Public Types inherited from foxit::pdf::GraphicsObjects
enum | TextMergeOption { e_TextMergeNone = 0, e_TextMergeTJY = 1, e_TextMergeBTET = 2 }
| Enumeration for text merge. More...

## Public Member Functions
| PDFPage (const foxit::pdf::GraphicsObjects &other)
| Constructor, with parent class object. More...
| PDFPage (const PDFDoc &document, objects::PDFDictionary *page_dict)
| Constructor, from a PDF dictionary which represents a PDF page and the PDF document which contains the dictionary.. More...
| ~PDFPage ()
| Destructor.
annots::Annot | AddAnnot (annots::Annot::Type type, const RectF &rect)
| Add an annotation to current PDF page. More...
annots::Annot | AddAnnot (objects::PDFDictionary *annot_dict)
| Add an annotation (by a valid annotation dictionary) to current PDF page. More...
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. More...
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. More...
bool | AddImageFromFilePath (const wchar_t *file_path, const PointF &position, float width, float height, bool auto_generate_content=true)
| Add an image to current page from file path. More...
foxit::pdf::Signature | AddSignature (const foxit::RectF &rect)
| Add an ordinary signature to PDF page. More...
foxit::pdf::Signature | AddSignature (const foxit::RectF &rect, const foxit::WString &field_name)
| Add an ordinary signature to PDF page. More...
foxit::pdf::Signature | AddSignature (const foxit::RectF &rect, const foxit::WString &field_name, foxit::pdf::Signature::SignatureType signature_type, bool to_check_permission=true)
| Add a signature to PDF page. More...
foxit::pdf::Signature | AddSignatureWithExistedVDict (const foxit::RectF &rect, const foxit::WString &field_name, foxit::pdf::Signature::SignatureType signature_type, bool to_check_permission, const foxit::pdf::Signature &existed_signature)
| Add a signature to PDF page with the existed "V" dictionary in the specific signature. More...
bool | AddText (const wchar_t *text, const foxit::RectF &rect, const foxit::pdf::RichTextStyle &style, const Matrix &matrix=Matrix(), bool is_each_text=false, bool disable_embed_font=false)
| Add text to current page. More...
RectF | AddText (const wchar_t *text, const foxit::RectF &rect, const foxit::pdf::RichTextStyle &style, int rotation, common::RotationPointOptions rotate_point=common::e_RotationPointCenter, bool disable_embed_font=false)
| Add text to current page. More...
RectF | CalcContentBBox (CalcMarginMode mode)
| Calculate the content area of PDF page. More...
RectF | CalculateNewRectForText (const wchar_t *text, const foxit::RectF &rect, const foxit::pdf::RichTextStyle &style, int rotation, common::RotationPointOptions rotate_point=common::e_RotationPointCenter, bool disable_embed_font=false)
| Calculate the new text rectangle. More...
void | ClearRenderCache ()
| Clear render cache. More...
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 according to specified options. More...
bool | FlattenAnnot (annots::Annot annot)
| Flatten an annotation: the annotation is made to be a part of the page contents and be removed then. More...
annots::Annot | GetAnnot (int index)
| Get an annotation by index. More...
annots::Annot | GetAnnotAtDevicePoint (const PointF &position, float tolerance, const Matrix *matrix=0)
| Get the annotation at a specified position, in device coordinate system. More...
annots::Annot | GetAnnotAtPoint (const PointF &position, float tolerance)
| Get the annotation at a specified position, in PDF coordinate system. More...
int | GetAnnotCount ()
| Get the count of annotations. More...
objects::PDFArray * | GetAnnots () const
| Get the PDF array of "Annots". More...
annots::AnnotArray | GetAnnotsAtDevicePoint (const PointF &position, float tolerance, const Matrix *matrix=0)
| Get all the annotations at a specified position, in device coordinate system. More...
annots::AnnotArray | GetAnnotsAtPoint (const PointF &position, float tolerance)
| Get all the annotations at a specified position, in PDF coordinate system. More...
RectF | GetBox (BoxType box_type)
| Get page box. More...
objects::PDFObject * | GetContents () const
| Get the PDF object of "Contents". More...
objects::PDFDictionary * | GetDict () const
| Get the page dictionary. More...
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. More...
PDFDoc | GetDocument () const
| Get the PDF document, to which current PDF page belongs. More...
graphics::GraphicsObject * | GetGraphicsObjectAtDevicePoint (const PointF &point, float tolerance, const Matrix *matrix, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll) const
| Get the topmost graphics object in specified point in device coordinate system, with specified type filter. More...
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. More...
graphics::GraphicsObject * | GetGraphicsObjectAtRectangle (const RectF &rect, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll) const
| Get the topmost graphics object whose rectangle interasects with a specified rectangle, with specified type filter. More...
graphics::GraphicsObjectArray | GetGraphicsObjectsAtDevicePoint (const PointF &point, float tolerance, const Matrix *matrix, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll)
| Get all the graphics objects in specified point in device coordinate system, with specified type filter. More...
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. More...
graphics::GraphicsObjectArray | GetGraphicsObjectsAtRectangle (const RectF &rect, graphics::GraphicsObject::Type filter=graphics::GraphicsObject::e_TypeAll)
| Get all the graphics objects whose rectangles intersect with a specified rectangle, with specified type filter. More...
float | GetHeight () const
| Get the page height (unit is 1/72 inch). More...
int | GetIndex () const
| Get page index. More...
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 tree. More...
objects::PDFDictionary * | GetResources () const
| Get the PDF dictionary of "Resources". More...
common::Rotation | GetRotation () const
| Get the page rotation. More...
RectF | GetSuggestedRect (const common::Bitmap &render_result, const Matrix &render_matrix, const PointF &point) const
| Get the suggested rectangle (in PDF coordinate system) for a point (in PDF coordinate system) based on the rendering result bitmap. More...
objects::PDFStream * | GetThumb () const
| Get the PDF stream of "Thumb". More...
float | GetUserUnitSize () const
| Get the user unit. More...
float | GetWidth () const
| Get the page width (unit is 1/72 inch). More...
bool | HasTransparency ()
| Check whether current PDF page has transparency or not. More...
bool | HasWatermark ()
| Check whether the current page has any watermark (not including Foxit PDF SDK trial watermark). More...
bool | IsParsed () const
| Check if current page has been parsed or not. More...
bool | IsScanned ()
| Check whether current PDF page is scanned page or not. More...
common::Bitmap | LoadThumbnail ()
| Load the thumbnail bitmap. More...
void | MoveAnnotToFirst (const annots::Annot &annot)
| Change specified annotation to be the first one of all annotations. More...
void | MoveAnnotToLast (const annots::Annot &annot)
| Change specified annotation to be the last one of all annotations. More...
void | MoveAnnotToNext (const annots::Annot &annot)
| Exchange the indexes of current annotation and its next annotation. More...
void | MoveAnnotToPrev (const annots::Annot &annot)
| Exchange the indexes of current annotation and its previous annotation. More...
bool | Normalize ()
| Transform current PDF page by undoing any rotation and removing the offset to the page's "CropBox". More...
bool | RemoveAllWatermarks ()
| Remove all watermarks. More...
bool | RemoveAnnot (const annots::Annot &annot)
| Remove an annotation. More...
bool | SetAnnotGroup (const annots::MarkupArray &annot_array, int header_index)
| Group all the input markup annotations together. More...
void | SetBox (BoxType box_type, const RectF &box)
| Set page box. More...
void | SetClipRect (const RectF &clip_rect)
| Set clip rectangle for all graphics objects on current PDF page. More...
void | SetRotation (common::Rotation rotate)
| Set page rotation. More...
void | SetSize (float width, float height)
| Set page width and height. More...
void | SetSize (foxit::pdf::PDFPage::Size size)
| Set page size type. More...
void | SetThumbnail (const common::Bitmap &thumbnail)
| Set page thumbnail. More...
void | SetUserUnitSize (float user_unit)
| Set the user unit. More...
graphics::TextObjectArray | SplitTextsInRectangle (RectF rect, int split_step)
| Split text objects whose rectangles (in PDF coordinate system) intersect with a specified rectangle (in PDF coordinate system), and further split the intersecting portion based on split_step. More...
common::Progressive | StartParse (uint32 flags=PDFPage::e_ParsePageNormal, common::PauseCallback *pause=0, bool is_reparse=false)
| Start to parse current page. More...
bool | Transform (const Matrix &matrix, bool need_transform_clip_path, bool need_transform_annotations=false)
| Transform a PDF page, including annotations and form fields on the page. More...
void | UpdateAnnotList ()
| Update the annotation list. More...
Public Member Functions inherited from foxit::pdf::GraphicsObjects
| GraphicsObjects (const GraphicsObjects &other)
| Constructor, with another GraphicsObjects object. More...
virtual | ~GraphicsObjects ()
| Destructor.
bool | GenerateContent ()
| Generate contents of current graphics objects. More...
bool | GenerateContent (TextMergeOption text_merge_option)
| Generate contents of current graphics objects. More...
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. More...
graphics::GraphicsObject * | GetGraphicsObject (int index) const
| Get a graphics object by index. More...
graphics::GraphicsObject * | GetGraphicsObject (POSITION position) const
| Get the graphics object by position in graphics object list. More...
int | GetGraphicsObjectCount () const
| Get the count of graphics objects in graphics object list. More...
int | GetGraphicsObjectIndex (graphics::GraphicsObject *graphics_object) const
| Get the index of a specified graphics object in graphics object list. More...
POSITION | GetGraphicsObjectPosition (graphics::GraphicsObject *graphics_object)
| Get the position of the specified graphics object. More...
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. More...
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 current position. More...
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 specified current position. More...
POSITION | InsertGraphicsObject (POSITION position_insert_after, graphics::GraphicsObject *graphics_object)
| Insert a graphics object after the specified position. More...
bool | IsEmpty () const
| Check whether current object is empty or not. More...
POSITION | MoveGraphicsObjectByPosition (POSITION current_position, POSITION position_move_after)
| Move a graphics object from a position to another position. More...
bool | operator!= (const GraphicsObjects &other) const
| Not equal operator. More...
GraphicsObjects & | operator= (const GraphicsObjects &other)
| Assign operator. More...
bool | operator== (const GraphicsObjects &other) const
| Equal operator. More...
bool | RemoveGraphicsObject (graphics::GraphicsObject *graphics_object)
| Remove a graphics object. More...
bool | RemoveGraphicsObjectByPosition (POSITION position)
| Remove a graphics object by position. More...
Public Member Functions inherited from foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## Detailed Description

A PDF page is defined in PDF coordinate system which uses the lower-left corner of the page as origin point (0, 0).
Usually, a PDF page object is retrieved from a PDF document by function PDFDoc::GetPage. For most case, a PDF page should be parsed first and then be used. Function PDFPage::IsParsed can be used to judge whether the PDF page has been parsed or not. For a unparsed page, please use function PDFPage::StartParse to parse it.
This class offers functions to get/set data of a PDF page, such as page width/height, page rotation, display matrix and so on. Also, this class offers functions to retrieve PDF annotations:

- To get a PDF annotation, use function pdf::PDFPage::GetAnnot, PDFPage::GetAnnotAtPoint, or PDFPage::GetAnnotAtDevicePoint.
- To add a new PDF annotation, use function PDFPage::AddAnnot.
- To remove a PDF annotation, use function PDFPage::RemoveAnnot.

Class pdf::PDFPage is derived from class pdf::GraphicsObjects, so class PDFPage also offers functions to retrieve PDF graphics objects:

- To get a PDF graphics object, use functions GraphicsObjects::GetFirstGraphicsObjectPosition, GraphicsObjects::GetNextGraphicsObjectPosition, GraphicsObjects::GetLastGraphicsObjectPosition, pdf::GraphicsObjects::GetPrevGraphicsObjectPosition and GraphicsObjects::GetGraphicsObject (these functions are inherited from parent class), or PDFPage::GetGraphicsObjectAtPoint.
- To insert a PDF graphics object, use function GraphicsObjects::InsertGraphicsObject (inherited from parent class).
- To remove a PDF graphics object, use functions GraphicsObjects::RemoveGraphicsObjectByPosition or GraphicsObjects::RemoveGraphicsObject (these functions are inherited from parent class).

This class object can also be used to construct objects of other classes in order to access specified information in PDF page:

- To access text content in PDF page, please construct a TextPage with PDF page object.
- To do reflowing, please construct a ReflowPage with PDF page object.
- To access additional actions, please construct an actions::AdditionalAction object with PDF page object.
- To manage the tab order of annotations in PDF page, please construct a TabOrderMgr with PDF page object.

See also
  PDFDoc
  GraphicsObjects
  TextPage
  ReflowPage
  actions::AdditionalAction
  TabOrderMgr

## Member Enumeration Documentation

## ◆ BoxType

enum foxit::pdf::PDFPage::BoxType

Enumeration for page box type.

Values of this enumeration should be used alone.

Enumerator
e_MediaBox | Media Box for page boundary. The boundary of the physical medium on which page is to be displayed or printed.
e_CropBox | Crop Box for page boundary. The region to which the contents of page are to be clipped (cropped) while displaying or printing.
e_TrimBox | Trim Box for page boundary. The region to which the contents of page should be clipped while outputting in a production environment.
e_ArtBox | Art Box for page boundary. The intended dimensions of a finished page after trimming.
e_BleedBox | Bleed Box for page boundary. The extent of page's meaningful content (including potential white space) as intended by page's creator.

## ◆ CalcMarginMode

enum foxit::pdf::PDFPage::CalcMarginMode

Enumeration for calculating margin mode.

Values of this enumeration should be used alone.

Enumerator
e_CalcContentsBox | Calculate margin according to bounding box of all contents.
e_CalcDetection | Calculate margin by detecting paths or images.

## ◆ FlattenOptions

enum foxit::pdf::PDFPage::FlattenOptions

Enumeration for flatten options.

Values of this enumeration can be used alone or in combination.

Enumerator
e_FlattenAll | Flatten all contents of a PDF page.
e_FlattenNoAnnot | Flatten a PDF page without annotations.
e_FlattenNoFormControl | Flatten a PDF page without form controls.

## ◆ ParseFlags

enum foxit::pdf::PDFPage::ParseFlags

Enumeration for parsing flags used for PDF page.

Values of this enumeration can be used alone or in combination.

Enumerator
e_ParsePageNormal | Parsing flag for normal mode, which means to parse all the contents in a PDF page.
e_ParsePageTextOnly | Parsing flag for text-only mode.

## ◆ Size

enum foxit::pdf::PDFPage::Size

Enumeration for page size type.

Values of this enumeration should be used alone.

Enumerator
e_SizeLetter | Page size: letter.
e_SizeLegal | Page size: legal.
e_SizeA2 | Page size: A2.
e_SizeA3 | Page size: A3.
e_SizeA4 | Page size: A4.
e_SizeA5 | Page size: A5.
e_SizeA6 | Page size: A6.
e_SizeB2 | Page size: B2.
e_SizeB3 | Page size: B3.
e_SizeB4 | Page size: B4.
e_SizeB5 | Page size: B5.
e_SizeB6 | Page size: B6.

## Constructor & Destructor Documentation

## ◆ PDFPage() [1/2]

foxit::pdf::PDFPage::PDFPage | ( | const PDFDoc & | document,
|  | objects::PDFDictionary * | page_dict
| ) |  |

Constructor, from a PDF dictionary which represents a PDF page and the PDF document which contains the dictionary..

Parameters

  [in] | document | A valid PDF document.
  [in] | page_dict | A PDF dictionary of a PDF page. It should belong to the PDF document specified by parameter document.

## ◆ PDFPage() [2/2]

foxit::pdf::PDFPage::PDFPage | ( | const foxit::pdf::GraphicsObjects & | other | ) |
| explicit

Constructor, with parent class object.

Parameters

  [in] | other | Parent class object.

## Member Function Documentation

## ◆ AddAnnot() [1/2]

annots::Annot foxit::pdf::PDFPage::AddAnnot | ( | annots::Annot::Type | type,
|  | const RectF & | rect
| ) |  |

Add an annotation to current PDF page.

Currently, this function can support to add most annotation types except:
Widget, Sound, Movie, PrinterMark, TrapNet, Watermark, 3D, PSInk, Redact.
Attention:

- Widget annotation are used to represent the appearance of a form field, including signature field:
  For signature field, function PDFPage::AddSignature can be called to add a new signature object.
  For other types of form field, function interform::Form::AddControl can be called to add a new form field (with form control).
- PSInk annotation should be converted from a PSI object by function PSI::ConvertToPDFAnnot.
- Redact annotation should be added to mark areas in PDF page by function addon::Redaction::MarkRedactAnnot.
- For supported annotations types, if user does not set any properties of the newly created annotation (except the required properties) and directly calls function annots::Annot::ResetAppearanceStream, default appearance will be used. Please refer to comment of concrete annotation class for more details of their own default appearance.

Parameters

  [in] | type | The type of annotation to be added. Please refer to values starting from annots::Annot::e_Note and this should be one of these values except annots::Annot::e_PSInk, annots::Annot::e_Sound, annots::Annot::e_Movie, annots::Annot::e_Widget, annots::Annot::e_PrinterMark, annots::Annot::e_TrapNet, annots::Annot::e_Watermark, annots::Annot::e_3D.
  [in] | rect | Rectangle of the new annotation. For annotation in following type, they needs a valid rectangle when being added. So for them, rect should be valid: annots::Annot::e_Note, annots::Annot::e_Link, annots::Annot::e_Square, annots::Annot::e_Circle, annots::Annot::e_FreeText, annots::Annot::e_Stamp, annots::Annot::e_Caret, annots::Annot::e_FileAttachment, annots::Annot::e_Screen. For rest supported annotation types, their rectangle will be updated when other required properties of them have been set. So for these annotations, rect can be an empty rectangle. If an invalid rectangle is passed to rect, an empty rectangle will be used instead.

Returns
  The newly created annotation object.

## ◆ AddAnnot() [2/2]

annots::Annot foxit::pdf::PDFPage::AddAnnot | ( | objects::PDFDictionary * | annot_dict | ) |

Add an annotation (by a valid annotation dictionary) to current PDF page.

Parameters

  [in] | annot_dict | An valid annotation dictionary which is to be added as an annotation to current PDF page.

Returns
  The newly created annotation object.

## ◆ AddImage()

bool foxit::pdf::PDFPage::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.

If the type of image is common::Image::e_JPG, the image should be kept valid until the related document is closed.

Parameters

  [in] | image | An image. One of its frames will be set to current page. This image contains at least one frame and the image type should not be common::Image::e_Unknown.
  [in] | frame_index | Frame index. Valid range: from 0 to (count-1). count is returned by function common::Image::GetFrameCount.
  [in] | position | A specified position which is the bottom left corner of image object, in PDF coordinate system.
  [in] | width | The width which is used for the image to set into page (unit is 1/72 inch). The value should be larger than 0.
  [in] | height | The height which is used for the image to set into page (unit is 1/72 inch). The value should be larger than 0.
  [in] | auto_generate_content | true means to generate content internally. When using false, user should ensure to call function GraphicsObjects::GenerateContent after adding image. Please refer to function GraphicsObjects::GenerateContent for more details. Default value: true.

Returns
  true means success, while false means failure.

## ◆ AddImageFromFilePath() [1/2]

bool foxit::pdf::PDFPage::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.

If input image (specified by file path) has more than one frame, only the first frame will be added to current page acquiescently.

Parameters

  [in] | file_path | A full path of an existing image file. It should not be an empty string.
  [in] | position | A specified position which is the bottom left corner of image object, in PDF coordinate system.
  [in] | width | The width which is used for the image to set into page. The value should be larger than 0.
  [in] | height | The height which is used for the image to set into page. The value should be larger than 0.
  [in] | auto_generate_content | true means to generate content internally. When using false, user should ensure to call function GraphicsObjects::GenerateContent after adding image. Please refer to function GraphicsObjects::GenerateContent for more details. Default value: true.

Returns
  true means success, while false means failure.

## ◆ AddImageFromFilePath() [2/2]

bool foxit::pdf::PDFPage::AddImageFromFilePath | ( | const wchar_t * | file_path,
|  | const PointF & | position,
|  | float | width,
|  | float | height,
|  | bool | auto_generate_content = `true`
| ) |  |

Add an image to current page from file path.

If input image (specified by file path) has more than one frame, only the first frame will be added to current page acquiescently.

Parameters

  [in] | file_path | A full path of an existing image file. It should not be an empty string.
  [in] | position | A specified position which is the bottom left corner of image object, in PDF coordinate system.
  [in] | width | The width which is used for the image to set into page. The value should be larger than 0.
  [in] | height | The height which is used for the image to set into page. The value should be larger than 0.
  [in] | auto_generate_content | true means to generate content internally. When using false, user should ensure to call function GraphicsObjects::GenerateContent after adding image. Please refer to function GraphicsObjects::GenerateContent for more details. Default value: true.

Returns
  true means success, while false means failure.

## ◆ AddSignature() [1/3]

foxit::pdf::Signature foxit::pdf::PDFPage::AddSignature | ( | const foxit::RectF & | rect | ) |

Add an ordinary signature to PDF page.

For a new ordinary signature, its filter will be "Adobe.PPKLite" and sub filter will be "adbe.pkcs7.detached" by default. Please refer to class Signature for more details about signature's filter and sub-filter.
Before signing the new signature, user can also call setting functions of class Signature to set other information used for signing and signed appearance.

Parameters

  [in] | rect | Rectangle position for the new signature, in PDF coordinate system. It should be a valid rectangle in PDF coordinate system.

Returns
  The newly added signature object.

## ◆ AddSignature() [2/3]

foxit::pdf::Signature foxit::pdf::PDFPage::AddSignature | ( | const foxit::RectF & | rect,
|  | const foxit::WString & | field_name
| ) |  |

Add an ordinary signature to PDF page.

For a new ordinary signature, its filter will be "Adobe.PPKLite" and sub filter will be "adbe.pkcs7.detached" by default. Please refer to class Signature for more details about signature's filter and sub-filter.
Before signing the new signature, user can also call setting functions of class Signature to set other information used for signing and signed appearance.

Parameters

  [in] | rect | Rectangle position for the new signature, in PDF coordinate system. It should be a valid rectangle in PDF coordinate system.
  [in] | field_name | The signature field name. This can be an empty string.

Returns
  The newly added signature object.

## ◆ AddSignature() [3/3]

foxit::pdf::Signature foxit::pdf::PDFPage::AddSignature | ( | const foxit::RectF & | rect,
|  | const foxit::WString & | field_name,
|  | foxit::pdf::Signature::SignatureType | signature_type,
|  | bool | to_check_permission = `true`
| ) |  |

Add a signature to PDF page.

For a new ordinary signature, its filter will be "Adobe.PPKLite" and sub filter will be "adbe.pkcs7.detached" by default. For a new time stamp signature, its filter will be "Adobe.PPKLite" and sub filter will be "ETSI.RFC3161" by default. Please refer to class Signature for more details about signature's filter and sub-filter.
Before signing the new signature, user can also call setting functions of class Signature to set other information used for signing and signed appearance.

Parameters

  [in] | rect | Rectangle position for the new signature, in PDF coordinate system. If parameter signature_type is Signature::e_SignatureTypeTimeStamp, this rectangle will be ignored; otherwise, this should be a valid rectangle in PDF coordinate system.
  [in] | field_name | The signature field name. This can be an empty string.
  [in] | signature_type | Signature type. Please refer to values starting from Signature::e_SignatureTypeOrdinary and this should be one of these values.
  [in] | to_check_permission | A boolean value to decide whether Foxit PDF SDK should check PDF document's permission before adding signature: true means Foxit PDF SDK should check document permission to decide if adding signature is allowed, while false means Foxit PDF SDK should not check document permission before adding signature. When this parameter is false, user should ensure to check document permission to check if adding signature is allowed. Default value: true.

Returns
  The newly added signature object.

## ◆ AddSignatureWithExistedVDict()

foxit::pdf::Signature foxit::pdf::PDFPage::AddSignatureWithExistedVDict | ( | const foxit::RectF & | rect,
|  | const foxit::WString & | field_name,
|  | foxit::pdf::Signature::SignatureType | signature_type,
|  | bool | to_check_permission,
|  | const foxit::pdf::Signature & | existed_signature
| ) |  |

Add a signature to PDF page with the existed "V" dictionary in the specific signature.

For a new ordinary signature, its filter will be "Adobe.PPKLite" and sub filter will be "adbe.pkcs7.detached" by default. For a new time stamp signature, its filter will be "Adobe.PPKLite" and sub filter will be "ETSI.RFC3161" by default. Please refer to class Signature for more details about signature's filter and sub-filter.
Before signing the new signature, user can also call setting functions of class Signature to set other information used for signing and signed appearance. After sharing the V dictionary, any changes to the entries related to the V dictionary will simultaneously affect the signature's appearance of all signagures shared V dictionaries.

Parameters

  [in] | rect | Rectangle position for the new signature, in PDF coordinate system. If parameter signature_type is Signature::e_SignatureTypeTimeStamp, this rectangle will be ignored; otherwise, this should be a valid rectangle in PDF coordinate system.
  [in] | field_name | The signature field name. This can be an empty string.
  [in] | signature_type | Signature type. Please refer to values starting from Signature::e_SignatureTypeOrdinary and this should be one of these values.
  [in] | to_check_permission | A boolean value to decide whether Foxit PDF SDK should check PDF document's permission before adding signature: true means Foxit PDF SDK should check document permission to decide if adding signature is allowed, while false means Foxit PDF SDK should not check document permission before adding signature. When this parameter is false, user should ensure to check document permission to check if adding signature is allowed. Default value: true.
  [in] | existed_signature | The signature whose "V" dictionary will be used in the newly added signature.

Returns
  The newly added signature object.

## ◆ AddText() [1/2]

bool foxit::pdf::PDFPage::AddText | ( | const wchar_t * | text,
|  | const foxit::RectF & | rect,
|  | const foxit::pdf::RichTextStyle & | style,
|  | const Matrix & | matrix = `Matrix()`,
|  | bool | is_each_text = `false`,
|  | bool | disable_embed_font = `false`
| ) |  |

Add text to current page.

The text wraps around if it is too long to fit the rectangle.

Parameters

  [in] | text | Content of the new text string. This should not be an empty string.
  [in] | rect | The box rectangle, in PDF coordinate system.
  [in] | style | Style data used for the new text string.
  [in] | matrix | The transformation matrix used for adding text block.
  [in] | is_each_text | A boolean value indicating whether to apply the transformation matrix individually to each text object within the text block.true means to use individual matrix for each text object, while false means to use the same matrix for the entire text block.
  [in] | disable_embed_font | A boolean value which indicates whether to disable embed font. true means to disable embed font, while false means not to.

Returns
  true means success, while false means failure.

Note
  When this function succeeds, function GraphicsObjects::GenerateContent should be called. Please refer to function GraphicsObjects::GenerateContent for more details.

## ◆ AddText() [2/2]

RectF foxit::pdf::PDFPage::AddText | ( | const wchar_t * | text,
|  | const foxit::RectF & | rect,
|  | const foxit::pdf::RichTextStyle & | style,
|  | int | rotation,
|  | common::RotationPointOptions | rotate_point = `common::e_RotationPointCenter`,
|  | bool | disable_embed_font = `false`
| ) |  |

Add text to current page.

The text wraps around if it is too long to fit the rectangle.

Parameters

  [in] | text | Content of the new text string. This should not be an empty string.
  [in] | rect | The box rectangle, in PDF coordinate system.
  [in] | style | Style data used for the new text string.
  [in] | rotation | The rotation value for the new text string.
  [in] | rotate_point | The rotation reference point. Please refer to values starting from common::e_RotationPointCenter and this should be one of these values.
  [in] | disable_embed_font | A boolean value which indicates whether to disable embed font. true means to disable embed font, while false means not to.

Returns
  The rectangle for the content of the text block.

Note
  When this function succeeds, function GraphicsObjects::GenerateContent should be called. Please refer to function GraphicsObjects::GenerateContent for more details.

## ◆ CalcContentBBox()

RectF foxit::pdf::PDFPage::CalcContentBBox | ( | CalcMarginMode | mode | ) |

Calculate the content area of PDF page.

Before using this function, please ensure current page has been parsed.

Parameters

  [in] | mode | Calculation mode. It should be one of following values: PDFPage::e_CalcContentsBox means to calculate margin according to bounding box of all contents. PDFPage::e_CalcDetection means to calculate margin by detecting paths or images.

Returns
  The minimal rectangle which contains the visible page content.

## ◆ CalculateNewRectForText()

RectF foxit::pdf::PDFPage::CalculateNewRectForText | ( | const wchar_t * | text,
|  | const foxit::RectF & | rect,
|  | const foxit::pdf::RichTextStyle & | style,
|  | int | rotation,
|  | common::RotationPointOptions | rotate_point = `common::e_RotationPointCenter`,
|  | bool | disable_embed_font = `false`
| ) |  |

Calculate the new text rectangle.

Parameters

  [in] | text | Content of the new text string. This should not be an empty string.
  [in] | rect | The box rectangle, in PDF coordinate system.
  [in] | style | Style data used for the new text string.
  [in] | rotation | The rotation value for the new text string.
  [in] | rotate_point | The rotation reference point. Please refer to values starting from common::e_RotationPointCenter and this should be one of these values.
  [in] | disable_embed_font | A boolean value which indicates whether to disable embed font. true means to disable embed font, while false means not to.

Returns
  The rectangle for the content of the text block.

## ◆ ClearRenderCache()

void foxit::pdf::PDFPage::ClearRenderCache | ( |  | ) |

Clear render cache.

Returns
  None.

## ◆ Flatten()

bool foxit::pdf::PDFPage::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 according to specified options.

Annotation flag can decide if an annotation can be displayed or if an annotation can be printed. This also affects the flattened result:

- If the flattened result is used for displaying, only annotations which can be displayed will be flattened to be a part of page contents.
- If the flattened result is used for printing, only annotations which can be printed will be flattened to be a part of page contents.

Form field's appearance is represents by widget annotation which is a kind of annotation and treated as form control in Foxit PDF SDK. So annotation flag affects a form field as well when a form field is to be flattened. For more details about annotation flag, please refer to values starting from annots::Annot::e_FlagInvisible and Section 8.4.2 "Annotation Flags" in <PDF Reference 1.7>.
After an annotation or a form field is flattened, it will not be an annotation or a form field any more. After flattening current page successfully, user should re-parse this page by function PDFPage::StartParse.

Parameters

  [in] | for_display | Decide the purpose of the flattened result: true means the flatten result is used for display only, and false means the flatten result is used for print only.
  [in] | options | The flatten options. Please refer to values starting from PDFPage::e_FlattenAll and this should one or a combination of them. Specially, if PDFPage::e_FlattenNoAnnot and PDFPage::e_FlattenNoFormControl are used together, that means nothing is to be flatten to page and this function will return true directly. Default value: PDFPage::e_FlattenAll.

Returns
  true means current page is flattened successfully, while false means failure.

## ◆ FlattenAnnot()

bool foxit::pdf::PDFPage::FlattenAnnot | ( | annots::Annot | annot | ) |

Flatten an annotation: the annotation is made to be a part of the page contents and be removed then.

After flattening the annotation successfully, user should re-parse this page by function PDFPage::StartParse.

Parameters

  [in] | annot | An annotation to be flattened and removed.

Returns
  true means success, while false means failure.

## ◆ GetAnnot()

annots::Annot foxit::pdf::PDFPage::GetAnnot | ( | int | index | ) |

Get an annotation by index.

Parameters

  [in] | index | Annotation index. Valid range: from 0 to (count-1). count is returned by function PDFPage::GetAnnotCount.

Returns
  An annotation object.

## ◆ GetAnnotAtDevicePoint()

annots::Annot foxit::pdf::PDFPage::GetAnnotAtDevicePoint | ( | const PointF & | position,
|  | float | tolerance,
|  | const Matrix * | matrix = `0`
| ) |  |

Get the annotation at a specified position, in device coordinate system.

If there are several annotations in this specified position, this function will always return the topmost annotation. Annotations with flag annots::Annot::e_FlagNoView or annots::Annot::e_FlagHidden or annots::Annot::e_FlagInvisible will not be retrieved by this function.If the returned annotation has a flag annots::Annot::e_FlagReadOnly,it cannot be modified.

Parameters

  [in] | position | The specified position, in device coordinate system.
  [in] | tolerance | Tolerance value. Valid range: 0.0f to 30.0f.
  [in] | matrix | The transformation matrix. Usually this is returned by function PDFPage::GetDisplayMatrix. If this is NULL, current function will have the same feature as function PDFPage::GetAnnotAtPoint. Default value: NULL.

Returns
  An annotation object. If the return value of function annots::Annot::IsEmpty for the returned annotation object is true, that means no PDF annotation can be found.

## ◆ GetAnnotAtPoint()

annots::Annot foxit::pdf::PDFPage::GetAnnotAtPoint | ( | const PointF & | position,
|  | float | tolerance
| ) |  |

Get the annotation at a specified position, in PDF coordinate system.

If there are several annotations in this specified position, this function will always return the topmost annotation. Annotations with flag annots::Annot::e_FlagNoView or annots::Annot::e_FlagHidden or annots::Annot::e_FlagInvisible will not be retrieved by this function. If the returned annotation has a flag annots::Annot::e_FlagReadOnly,it cannot be modified.

Parameters

  [in] | position | The specified position, in PDF coordinate system.
  [in] | tolerance | Tolerance value. Valid range: 0.0f to 30.0f.

Returns
  An annotation object. If the return value of function annots::Annot::IsEmpty for the returned annotation object is true, that means no PDF annotation can be found.

## ◆ GetAnnotCount()

int foxit::pdf::PDFPage::GetAnnotCount | ( |  | ) |

Get the count of annotations.

Returns
  The count of annotations.

## ◆ GetAnnots()

objects::PDFArray* foxit::pdf::PDFPage::GetAnnots | ( |  | ) | const

Get the PDF array of "Annots".

Note
  Please refer to "TABLE 3.27 Entries in a page object" in <PDF Reference 1.7> P147 for more details.

Returns
  The PDF array of "Annots". If there is no "Annots" entry or any error occurs, this function will return NULL.

## ◆ GetAnnotsAtDevicePoint()

annots::AnnotArray foxit::pdf::PDFPage::GetAnnotsAtDevicePoint | ( | const PointF & | position,
|  | float | tolerance,
|  | const Matrix * | matrix = `0`
| ) |  |

Get all the annotations at a specified position, in device coordinate system.

In one specified position, there may exist several annotations. This function can be used to retrieve all these annotations in the specified position. Annotations with flag annots::Annot::e_FlagNoView or annots::Annot::e_FlagHidden or annots::Annot::e_FlagInvisible will not be retrieved by this function.
If the return annotation object of function annots::AnnotArray::GetAt for the returned annotation array object has flag annots::Annot::e_FlagReadOnly, that means the annotation cannot be modified.

Parameters

  [in] | position | The specified position, in device coordinate system.
  [in] | tolerance | Tolerance value. Valid range: 0.0f to 30.0f.
  [in] | matrix | The transformation matrix. Usually this is returned by function PDFPage::GetDisplayMatrix. If this is NULL, current function will have the same feature as function PDFPage::GetAnnotAtPoint. Default value: NULL.

Returns
  The array of annotation. If the return value of function annots::AnnotArray::GetSize for the returned annotation array object is 0, that means no PDF annotation can be found.

## ◆ GetAnnotsAtPoint()

annots::AnnotArray foxit::pdf::PDFPage::GetAnnotsAtPoint | ( | const PointF & | position,
|  | float | tolerance
| ) |  |

Get all the annotations at a specified position, in PDF coordinate system.

In one specified position, there may exist several annotations. This function can be used to retrieve all these annotations in the specified position. Annotations with flag annots::Annot::e_FlagNoView or annots::Annot::e_FlagHidden or annots::Annot::e_FlagInvisible will not be retrieved by this function.
If the return annotation object of function annots::AnnotArray::GetAt for the returned annotation array object has flag annots::Annot::e_FlagReadOnly, that means the annotation cannot be modified.

Parameters

  [in] | position | The specified position, in PDF coordinate system.
  [in] | tolerance | Tolerance value. Valid range: 0.0f to 30.0f.

Returns
  The array of annotation. If the return value of function annots::AnnotArray::GetSize for the returned annotation array object is 0, that means no PDF annotation can be found.

## ◆ GetBox()

RectF foxit::pdf::PDFPage::GetBox | ( | BoxType | box_type | ) |

Get page box.

Parameters

  [in] | box_type | Page box type. Please refer to values starting from PDFPage::e_MediaBox and this should be one of these values.

Returns
  A box rectangle, in PDF coordinate system.

## ◆ GetContents()

objects::PDFObject* foxit::pdf::PDFPage::GetContents | ( |  | ) | const

Get the PDF object of "Contents".

Note
  "Contents" can be either a PDF stream or a PDF array. Please refer to "TABLE 3.27 Entries in a page object" in <PDF Reference 1.7> P146 for more details.

Returns
  The PDF object of "Contents". If there is no "Contents" entry or any error occurs, this function will return NULL.

## ◆ GetDict()

objects::PDFDictionary* foxit::pdf::PDFPage::GetDict | ( |  | ) | const

Get the page dictionary.

Returns
  The page dictionary object. If there is any error, this function will return NULL.

## ◆ GetDisplayMatrix()

Matrix foxit::pdf::PDFPage::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.

Parameters

  [in] | left | Left position of the transformation area in device coordinate system, commonly in pixels.
  [in] | top | Top position of the transformation area in device coordinate system, commonly in pixels.
  [in] | width | Width of the transformation area in device coordinate system, commonly in pixels.
  [in] | height | Height of the transformation area in device coordinate system, commonly in pixels.
  [in] | rotate | Rotation value. Please refer to values starting from common::e_Rotation0 and this should be one of these values except common::e_RotationUnknown.

Returns
  The display matrix used for current PDF page.

## ◆ GetDocument()

PDFDoc foxit::pdf::PDFPage::GetDocument | ( |  | ) | const

Get the PDF document, to which current PDF page belongs.

Returns
  A PDF document object.

## ◆ GetGraphicsObjectAtDevicePoint()

graphics::GraphicsObject* foxit::pdf::PDFPage::GetGraphicsObjectAtDevicePoint | ( | const PointF & | point,
|  | float | tolerance,
|  | const Matrix * | matrix,
|  | graphics::GraphicsObject::Type | filter = `graphics::GraphicsObject::e_TypeAll`
| ) |  | const

Get the topmost graphics object in specified point in device coordinate system, with specified type filter.

Parameters

  [in] | point | A specified position, in device coordinate system.
  [in] | tolerance | Tolerance value for a graphics object hit detection, in point units. It should be positive.
  [in] | matrix | The transformation matrix. Usually this is returned by function PDFPage::GetDisplayMatrix. Default value: NULL.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from graphics::GraphicsObject::e_TypeAll and this should be one of these values. graphics::GraphicsObject::e_TypeAll means for all kinds of graphics objects. Default value: graphics::GraphicsObject::e_TypeAll.

Returns
  A graphics::GraphicsObject object. If no graphics object can be found, this function will return NULL.

## ◆ GetGraphicsObjectAtPoint()

graphics::GraphicsObject* foxit::pdf::PDFPage::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.

Parameters

  [in] | point | A specified position, in PDF coordinate system.
  [in] | tolerance | Tolerance value for a graphics object hit detection, in point units. It should be positive.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from graphics::GraphicsObject::e_TypeAll and this should be one of these values. graphics::GraphicsObject::e_TypeAll means for all kinds of graphics objects. Default value: graphics::GraphicsObject::e_TypeAll.

Returns
  A graphics::GraphicsObject object. If no graphics object can be found, this function will return NULL.

## ◆ GetGraphicsObjectAtRectangle()

graphics::GraphicsObject* foxit::pdf::PDFPage::GetGraphicsObjectAtRectangle | ( | const RectF & | rect,
|  | graphics::GraphicsObject::Type | filter = `graphics::GraphicsObject::e_TypeAll`
| ) |  | const

Get the topmost graphics object whose rectangle interasects with a specified rectangle, with specified type filter.

Parameters

  [in] | rect | A specified rectangle, in PDF coordinate system.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from graphics::GraphicsObject::e_TypeAll and this should be one of these values. graphics::GraphicsObject::e_TypeAll means for all kinds of graphics objects. Default value: graphics::GraphicsObject::e_TypeAll.

Returns
  A graphics object whose rectangle intersects with the specified rectangle. If no suitable graphics object can be found, this function will return NULL.

## ◆ GetGraphicsObjectsAtDevicePoint()

graphics::GraphicsObjectArray foxit::pdf::PDFPage::GetGraphicsObjectsAtDevicePoint | ( | const PointF & | point,
|  | float | tolerance,
|  | const Matrix * | matrix,
|  | graphics::GraphicsObject::Type | filter = `graphics::GraphicsObject::e_TypeAll`
| ) |  |

Get all the graphics objects in specified point in device coordinate system, with specified type filter.

Parameters

  [in] | point | A specified position, in device coordinate system.
  [in] | tolerance | Tolerance value for a graphics object hit detection, in point units. It should be positive.
  [in] | matrix | The transformation matrix. Usually this is returned by function PDFPage::GetDisplayMatrix. Default value: NULL.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from graphics::GraphicsObject::e_TypeAll and this should be one of these values. graphics::GraphicsObject::e_TypeAll means for all kinds of graphics objects. Default value: graphics::GraphicsObject::e_TypeAll.

Returns
  An array of graphics::GraphicsObject objects.

## ◆ GetGraphicsObjectsAtPoint()

graphics::GraphicsObjectArray foxit::pdf::PDFPage::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.

Parameters

  [in] | point | A specified position, in PDF coordinate system.
  [in] | tolerance | Tolerance value for a graphics object hit detection, in point units. It should be positive.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from graphics::GraphicsObject::e_TypeAll and this should be one of these values. graphics::GraphicsObject::e_TypeAll means for all kinds of graphics objects. Default value: graphics::GraphicsObject::e_TypeAll.

Returns
  An array of graphics::GraphicsObject objects.

## ◆ GetGraphicsObjectsAtRectangle()

graphics::GraphicsObjectArray foxit::pdf::PDFPage::GetGraphicsObjectsAtRectangle | ( | const RectF & | rect,
|  | graphics::GraphicsObject::Type | filter = `graphics::GraphicsObject::e_TypeAll`
| ) |  |

Get all the graphics objects whose rectangles intersect with a specified rectangle, with specified type filter.

Parameters

  [in] | rect | A specified rectangle, in PDF coordinate system.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from graphics::GraphicsObject::e_TypeAll and this should be one of these values. graphics::GraphicsObject::e_TypeAll means for all kinds of graphics objects. Default value: graphics::GraphicsObject::e_TypeAll.

Returns
  An array of graphics objects whose rectangle intersect with the specified rectangle.

## ◆ GetHeight()

float foxit::pdf::PDFPage::GetHeight | ( |  | ) | const

Get the page height (unit is 1/72 inch).

Returns
  Page height.

## ◆ GetIndex()

int foxit::pdf::PDFPage::GetIndex | ( |  | ) | const

Get page index.

Returns
  Page index, starting from 0 and within the count of pages in related PDF document.

## ◆ GetInheritedAttribute()

objects::PDFObject* foxit::pdf::PDFPage::GetInheritedAttribute | ( | const char * | attruibute_name | ) | const

Get the PDF object for specified attribute which may be inherited from the ancestor node in the page tree.

Some of the page attributes are designated as inheritable, such as "Resources", "MediaBox", "CropBox", and "Rotate". Please refer to "TABLE 3.27 Entries in a page object" in <PDF Reference 1.7> P145 and "Inheritance of Page Attributes" in <PDF Reference 1.7> P149 for more details.

Parameters

  [in] | attruibute_name | The name of attribute to be found.

Returns
  A PDF object. If not found, this function will return NULL.

## ◆ GetResources()

objects::PDFDictionary* foxit::pdf::PDFPage::GetResources | ( |  | ) | const

Get the PDF dictionary of "Resources".

Note
  Please refer to "TABLE 3.27 Entries in a page object" in <PDF Reference 1.7> P145 for more details.

Returns
  The PDF dictionary of "Resources". If there is no "Resources" entry or any error occurs, this function will return NULL.

## ◆ GetRotation()

common::Rotation foxit::pdf::PDFPage::GetRotation | ( |  | ) | const

Get the page rotation.

Returns
  Page rotation value. Please refer to values starting from common::e_Rotation0 and this would be one of these values.

## ◆ GetSuggestedRect()

RectF foxit::pdf::PDFPage::GetSuggestedRect | ( | const common::Bitmap & | render_result,
|  | const Matrix & | render_matrix,
|  | const PointF & | point
| ) |  | const

Get the suggested rectangle (in PDF coordinate system) for a point (in PDF coordinate system) based on the rendering result bitmap.

This function can help user to locate a rectangle area (as a suggested rectangle) around a specified point. When a valid suggested rectangle is retrieved, user can use the rectangle to add something to PDF page, such as a new annotation, a new form field, a new signature and etc.
The suggested rectangle for a point means a rectangle which contains specified point and can be drawn in the spare place around the specified point as large as possible. BUT, if any of left/right/top/bottom directions from the point reaches the input bitmap edges directly, no suggested rectangle can be retrieved.
This function does not support a Rbg565 bitmap. If input bitmap is a Rbg565 bitmap, this function will return an empty rectangle directly.

Parameters

  [in] | render_result | Bitmap as the result of rendering current PDF page. This should be a valid bitmap object.
  [in] | render_matrix | The transformation matrix used for rendering current PDF page and generating parameter render_result as rendering result.
  [in] | point | A point (in PDF coordinate system) for which a suggested rectangle is to be found.

Returns
  The suggested rectangle in PDF coordinate system. If the return value of function RectF::IsEmpty for the returned rectangle object is true, that means no suitable suggested rectangle can be found.

## ◆ GetThumb()

objects::PDFStream* foxit::pdf::PDFPage::GetThumb | ( |  | ) | const

Get the PDF stream of "Thumb".

Note
  Please refer to "TABLE 3.27 Entries in a page object" in <PDF Reference 1.7> P146 for more details.

Returns
  The PDF stream of "Thumb". If there is no "Thumb" entry or any error occurs, this function will return NULL.

## ◆ GetUserUnitSize()

float foxit::pdf::PDFPage::GetUserUnitSize | ( |  | ) | const

Get the user unit.

A positive number giving the size of default user space units, in multiples of 1/72 inch. The range of supported values is implementation-dependent.

Returns
  User unit.

## ◆ GetWidth()

float foxit::pdf::PDFPage::GetWidth | ( |  | ) | const

Get the page width (unit is 1/72 inch).

Returns
  Page width.

## ◆ HasTransparency()

bool foxit::pdf::PDFPage::HasTransparency | ( |  | ) |

Check whether current PDF page has transparency or not.

Before using this function, please ensure current page has been parsed.

Returns
  true means current page has transparency, while false means current page does not have transparency.

## ◆ HasWatermark()

bool foxit::pdf::PDFPage::HasWatermark | ( |  | ) |

Check whether the current page has any watermark (not including Foxit PDF SDK trial watermark).

Before using this function, please ensure current page has been parsed.

Returns
  true means the current page has watermark, and false means the current page has no watermark.

## ◆ IsParsed()

bool foxit::pdf::PDFPage::IsParsed | ( |  | ) | const

Check if current page has been parsed or not.

Returns
  true means current page has been parsed, while false means current page has not been parsed yet.

## ◆ IsScanned()

bool foxit::pdf::PDFPage::IsScanned | ( |  | ) |

Check whether current PDF page is scanned page or not.

Before using this function, please ensure current page has been parsed.

Returns
  true means current page is scanned, while false means current page is not scanned.

## ◆ LoadThumbnail()

common::Bitmap foxit::pdf::PDFPage::LoadThumbnail | ( |  | ) |

Load the thumbnail bitmap.

Returns
  The thumbnail bitmap of current page. If the return value of function common::Bitmap::IsEmpty for the returned bitmap object is true, that means no thumbnail can be found.

## ◆ MoveAnnotToFirst()

void foxit::pdf::PDFPage::MoveAnnotToFirst | ( | const annots::Annot & | annot | ) |

Change specified annotation to be the first one of all annotations.

In PDF page, all the annotations are managed in an annotation list. In the annotation list, annotations with small indexes (as in the font part of the list) will be drawn to the page first, and annotations with large indexes (as in the last part of the list) will be drawn to the page later. So, in a page, if an annotation is shown on the top of other annotations in z-order, that means its index is larger than other annotations in the annotation list.
This function is used to move an annotation from current index position to the first position in the annotation list, in order to move the annotation to the bottom in z-order when displayed.

Parameters

  [in] | annot | An annotation object to be moved to first. It should be in current PDF page.

Returns
  None.

## ◆ MoveAnnotToLast()

void foxit::pdf::PDFPage::MoveAnnotToLast | ( | const annots::Annot & | annot | ) |

Change specified annotation to be the last one of all annotations.

In PDF page, all the annotations are managed in an annotation list. In the annotation list, annotations with small indexes (as in the font part of the list) will be drawn to the page first, and annotations with large indexes (as in the last part of the list) will be drawn to the page later. So, in a page, if an annotation is shown on the top of other annotations in z-order, that means its index is larger than other annotations in the annotation list.
This function is used to move an annotation from current index position to the last position in the annotation list, in order to move the annotation to the top in z-order when displayed.

Parameters

  [in] | annot | An annotation object to be moved to last. It should be in current PDF page.

Returns
  None.

## ◆ MoveAnnotToNext()

void foxit::pdf::PDFPage::MoveAnnotToNext | ( | const annots::Annot & | annot | ) |

Exchange the indexes of current annotation and its next annotation.

In PDF page, all the annotations are managed in an annotation list. In the annotation list, annotations with small indexes (as in the font part of the list) will be drawn to the page first, and annotations with large indexes (as in the last part of the list) will be drawn to the page later. So, in a page, if an annotation is shown on the top of other annotations in z-order, that means its index is larger than other annotations in the annotation list.
This function is used to exchange the indexes position of current annotation and its next annotation in the annotation list, in order to move the annotation to an upper level in z-order when displayed.

Parameters

  [in] | annot | An annotation object to be moved. It should be in current PDF page.

Returns
  None.

## ◆ MoveAnnotToPrev()

void foxit::pdf::PDFPage::MoveAnnotToPrev | ( | const annots::Annot & | annot | ) |

Exchange the indexes of current annotation and its previous annotation.

In PDF page, all the annotations are managed in an annotation list. In the annotation list, annotations with small indexes (as in the font part of the list) will be drawn to the page first, and annotations with large indexes (as in the last part of the list) will be drawn to the page later. So, in a page, if an annotation is shown on the top of other annotations in z-order, that means its index is larger than other annotations in the annotation list.
This function is used to exchange the indexes position of current annotation and its previous annotation in the annotation list, in order to move the annotation to a lower level in z-order when displayed.

Parameters

  [in] | annot | An annotation object to be moved. It should be in current PDF page.

Returns
  None.

## ◆ Normalize()

bool foxit::pdf::PDFPage::Normalize | ( |  | ) |

Transform current PDF page by undoing any rotation and removing the offset to the page's "CropBox".

Returns
  true means success, while false means failure.

Note
  Annotations and form fields will also be adjusted to remain in the same relative position on the PDF page. This makes it easier to add new items to the PDF page as the coordinate system will be relative to the bottom left corner of the visible page.

## ◆ RemoveAllWatermarks()

bool foxit::pdf::PDFPage::RemoveAllWatermarks | ( |  | ) |

Remove all watermarks.

Before using this function, please ensure current page has been parsed.

Returns
  true means success, while false means failure.

## ◆ RemoveAnnot()

bool foxit::pdf::PDFPage::RemoveAnnot | ( | const annots::Annot & | annot | ) |

Remove an annotation.

This function can remove any annotation returned by getting function or adding function.
But for widget annotation, this function can only remove an independent widget annotation. If the widget annotation is associated with a form field, this function cannot remove it and will throw exception foxit::e_ErrUnsupported.
For a widget annotation associated with a form field, please call function interform::Form::RemoveControl to remove it along with associated form control.

Parameters

  [in] | annot | An annotation object to be removed. It should be in current PDF page.

Returns
  true means success, while false means failure.

## ◆ SetAnnotGroup()

bool foxit::pdf::PDFPage::SetAnnotGroup | ( | const annots::MarkupArray & | annot_array,
|  | int | header_index
| ) |  |

Group all the input markup annotations together.

Markup annotations can be grouped. The group consists of a primary annotation and one or more subordinate annotations. Some entries in the primary annotation are treated as group attributes that should apply to the group as a whole; the corresponding entries in the subordinate annotations should be ignored. These entries are contents, last modification time, fill color/border color, title, pop-up annotation, creation time, subject, and open status. So user should respect the group property: when a property of an annotation in the group is changed, the other annotations in the same group should be changed too.
Operations that manipulate any annotation in a group, such as movement, cut, and copy, should be treated by viewer applications as acting on the entire group.

Parameters

  [in] | annot_array | An array of Markup objects that specifies markup annotations which are to be grouped together. This array should contains at least 2 markup annotations, and all the markup annotations in this array should be different from others. All the markup annotations in this array should be in current page. Specially, if a markup annotation in this array is already in another group, that group will be set to the new group with the new header as well.
  [in] | header_index | The index that specifies a markup annotation in parameter annot_array to be the header of the group. Valid range: from 0 to (annot_count -1).

Returns
  true means group input markup annotations together successfully, while false means failure.

## ◆ SetBox()

void foxit::pdf::PDFPage::SetBox | ( | BoxType | box_type,
|  | const RectF & | box
| ) |  |

Set page box.

Parameters

  [in] | box_type | Page box type. Please refer to values starting from PDFPage::e_MediaBox and this should be one of these values.
  [in] | box | New box rectangle, in PDF coordinate system.

Returns
  None.

## ◆ SetClipRect()

void foxit::pdf::PDFPage::SetClipRect | ( | const RectF & | clip_rect | ) |

Set clip rectangle for all graphics objects on current PDF page.

After this function finishes successfully, please re-parse current page by function PDFPage::StartParse with parameter is_reparse true.

Parameters

  [in] | clip_rect | New clip rectangle, in PDF coordinate system.

Returns
  None.

## ◆ SetRotation()

void foxit::pdf::PDFPage::SetRotation | ( | common::Rotation | rotate | ) |

Set page rotation.

Parameters

  [in] | rotate | New page rotation value. Please refer to values starting from common::e_Rotation0 and this should be one of these values except common::e_RotationUnknown.

Returns
  None.

## ◆ SetSize() [1/2]

void foxit::pdf::PDFPage::SetSize | ( | float | width,
|  | float | height
| ) |  |

Set page width and height.

When changing page width/height, Foxit PDF SDK will always do as following:
First, choose "page rotation is 0" as the basis page status and choose the left-bottom corner of the page (with page rotation is 0) as the basis point. And then, always change the position of top page boundary and right page boundary (with page rotation is 0) to change page size.

Parameters

  [in] | width | New page width. It should be a positive value and the unit is 1/72 inch.
  [in] | height | New page height. It should be a positive value and the unit is 1/72 inch.

Returns
  None.

## ◆ SetSize() [2/2]

void foxit::pdf::PDFPage::SetSize | ( | foxit::pdf::PDFPage::Size | size | ) |

Set page size type.

When changing page size, Foxit PDF SDK will always do as following:
First, choose "page rotation is 0" as the basis page status and choose the left-bottom corner of the page (with page rotation is 0) as the basis point. And then, always change the position of top page boundary and right page boundary (with page rotation is 0) to change page size.

Parameters

  [in] | size | Size type to specify the new size of current page. Please refer to values starting from PDFPage::e_SizeLetter and this should be one of these values.

Returns
  None.

## ◆ SetThumbnail()

void foxit::pdf::PDFPage::SetThumbnail | ( | const common::Bitmap & | thumbnail | ) |

Set page thumbnail.

Thumbnail bitmap does not use alpha channel. So user is recommended to set a bitmap without alpha channel to be the new thumbnail. If a bitmap with alpha channel is set, the new thumbnail will use white background by default. Currently, this function does not support the bitmap with format Bitmap::e_DIBRgb565.

Parameters

  [in] | thumbnail | New page thumbnail. It should be a valid bitmap.

Returns
  None.

## ◆ SetUserUnitSize()

void foxit::pdf::PDFPage::SetUserUnitSize | ( | float | user_unit | ) |

Set the user unit.

A positive number giving the size of default user space units, in multiples of 1/72 inch. The range of supported values is implementation-dependent. If not set, Foxit PDF SDK will use default value 1.0 (user unit is 1/72 inch).

Parameters

  [in] | user_unit | A positive number giving the size of default user space units, in multiples of 1/72 inch.

Returns
  None.

## ◆ SplitTextsInRectangle()

graphics::TextObjectArray foxit::pdf::PDFPage::SplitTextsInRectangle | ( | RectF | rect,
|  | int | split_step
| ) |  |

Split text objects whose rectangles (in PDF coordinate system) intersect with a specified rectangle (in PDF coordinate system), and further split the intersecting portion based on split_step.

This function splits text objects that intersect with the specified rectangle based on split_step. When a text object intersects with the specified rectangle, the intersecting portion will be divided into one or more text objects based on split_step. Similarly, for text objects that only partially intersect with the specified rectangle, their non-intersecting portions will be split off and treated as separate text objects. If split_step is greater than 0, the part of the text object that intersects with the specified rectangle will be split into several text objects. Specifically, each new text object will correspond to a segment in the specified rectangle, with the number of words in each segment defined by split_step. If the remaining number of words in the intersecting portion is less than split_step, those remaining words will be grouped into a single text object. If split_step is 0, the intersecting portion of the text object that intersects with the specified rectangle will not be split further and will be grouped into a single text object.

Parameters

  [in] | rect | A specified rectangle, in PDF coordinate system.
  [in] | split_step | The number of words used to split the text objects that intersects the specified rectangle. This value must not be negative. a value of 0 means the text objects that intersects with the specified rectangle will not be further split and will be grouped into a single text object.

Returns
  An array of text graphics objects that intersect with the specified rectangle after being split.

Note
  Text objects whose rectangles (in PDF coordinate system) intersect the specified rectangle (in PDF coordinate system) will be split separately and not merged together. If text objects whose rectangles (in PDF coordinate system) intersects the specified rectangle (in PDF coordinate system), but all of its characters lie outside the specified rectangle (in PDF coordinate system), the text objects would not be treated as split text objects within specified rectangle (in PDF coordinate system).

## ◆ StartParse()

common::Progressive foxit::pdf::PDFPage::StartParse | ( | uint32 | flags = `PDFPage::e_ParsePageNormal`,
|  | common::PauseCallback * | pause = `0`,
|  | bool | is_reparse = `false`
| ) |  |

Start to parse current page.

It may take a long time to parsing a PDF page, so Foxit PDF SDK uses a progressive process to do this. All the resources of page content will be loaded after the PDF page is parsed.
User can get the dictionary of page or annotations without parsing the page, but to perform operations related to the page content, please parse the page first.

Parameters

  [in] | flags | Parsing flags. Please refer to values starting from PDFPage::e_ParsePageNormal and this should be one or a combination of these values. Default value: PDFPage::e_ParsePageNormal.
  [in] | pause | Pause callback object which decides if the parsing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
  [in] | is_reparse | true means to re-parse current page, while false means not to re-parse current page. Default value: false.

Returns
  A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to continue the progress until the progress is finished.

Note
  When parameter is_reparse is set to true, that means to re-parse current PDF page, and all the retrieved graphics object's position (as POSITION object) and graphics object (as graphics::GraphicsObject object) will be invalid.
  Application needs to get graphics objects again after re-parsing a PDF page.

## ◆ Transform()

bool foxit::pdf::PDFPage::Transform | ( | const Matrix & | matrix,
|  | bool | need_transform_clip_path,
|  | bool | need_transform_annotations = `false`
| ) |  |

Transform a PDF page, including annotations and form fields on the page.

Note
  This function only supports scaling and translating. After this operation, please re-parse current page by function PDFPage::StartParse with parameter is_reparse true, in order that expected content will be displayed.

Parameters

  [in] | matrix | Transform matrix.
  [in] | need_transform_clip_path | true means to transform the page with clip rectangle, while false means not.
  [in] | need_transform_annotations | true means to transform the page with annotations. while false means not.

Returns
  true means success, while false means failure.

## ◆ UpdateAnnotList()

void foxit::pdf::PDFPage::UpdateAnnotList | ( |  | ) |

Update the annotation list.

If any annotation is modified(added/removed...) by changing "Annots" dictionary item directly, please call this function to update the annotation list after the changing.

Returns
  None.