Foxit PDF SDK
FSPDFPage Class Reference
Inheritance diagram for FSPDFPage:
FSGraphicsObjects FSBase

Instance Methods

(FSAnnot *) - addAnnot:rect:
 Add an annotation to current PDF page.
More...
 
(FSAnnot *) - addAnnotWithDictionary:
 Add an annotation (by a valid annotation dictionary) to current PDF page.
More...
 
(BOOL) - addImage:frame_index:position:width:height:auto_generate_content:
 Add an image to current page.
More...
 
(BOOL) - addImageFromFilePath:position:width:height:auto_generate_content:
 Add an image to current page from file path.
More...
 
(FSSignature *) - addSignature:
 Add an ordinary signature to PDF page.
More...
 
(FSSignature *) - addSignatureWithExistedVDict:field_name:signature_type:to_check_permission:existed_signature:
 Add a signature to PDF page with the existed "V" dictionary in the specific signature.
More...
 
(FSSignature *) - addSignatureWithFieldName:field_name:
 Add an ordinary signature to PDF page.
More...
 
(FSSignature *) - addSignatureWithSignatureType:field_name:signature_type:to_check_permission:
 Add a signature to PDF page.
More...
 
(BOOL) - addText:rect:style:disable_embed_font:
 Add text to current page.
More...
 
(FSRectF *) - addTextWithRotation:rect:style:rotation:disable_embed_font:
 Add text to current page.
More...
 
(FSRectF *) - calcContentBBox:
 Calculate the content area of PDF page.
More...
 
(void) - clearRenderCache
 Clear render cache.
More...
 
(BOOL) - flatten:options:
 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:
 Flatten an annotation: the annotation is made to be a part of the page contents and be removed then.
More...
 
(FSAnnot *) - getAnnot:
 Get an annotation by index.
More...
 
(FSAnnot *) - getAnnotAtDevicePoint:tolerance:matrix:
 Get the annotation at a specified position, in device coordinate system.
More...
 
(FSAnnot *) - getAnnotAtPoint:tolerance:
 Get the annotation at a specified position, in PDF coordinate system.
More...
 
(int) - getAnnotCount
 Get the count of annotations.
More...
 
(FSPDFArray *) - getAnnots
 Get the PDF array of "Annots".
More...
 
(FSAnnotArray *) - getAnnotsAtDevicePoint:tolerance:matrix:
 Get all the annotations at a specified position, in device coordinate system.
More...
 
(FSAnnotArray *) - getAnnotsAtPoint:tolerance:
 Get all the annotations at a specified position, in PDF coordinate system.
More...
 
(FSRectF *) - getBox:
 Get page box.
More...
 
(FSPDFObject *) - getContents
 Get the PDF object of "Contents".
More...
 
(FSPDFDictionary *) - getDict
 Get the page dictionary.
More...
 
(FSMatrix2D *) - getDisplayMatrix:top:width:height:rotate:
 Get the display matrix of PDF page, from PDF coordinate system to targeted device coordinate system.
More...
 
(FSPDFDoc *) - getDocument
 Get the PDF document, to which current PDF page belongs.
More...
 
(FSGraphicsObject *) - getGraphicsObjectAtDevicePoint:tolerance:matrix:filter:
 Get the topmost graphics object in specified point in device coordinate system, with specified type filter.
More...
 
(FSGraphicsObject *) - getGraphicsObjectAtPoint:tolerance:filter:
 Get the topmost graphics object in specified point, with specified type filter.
More...
 
(FSGraphicsObject *) - getGraphicsObjectAtRectangle:filter:
 Get the topmost graphics object whose rectangle interasects with a specified rectangle, with specified type filter.
More...
 
(FSGraphicsObjectArray *) - getGraphicsObjectsAtDevicePoint:tolerance:matrix:filter:
 Get all the graphics objects in specified point in device coordinate system, with specified type filter.
More...
 
(FSGraphicsObjectArray *) - getGraphicsObjectsAtPoint:tolerance:filter:
 Get all the graphics objects in specified point, with specified type filter.
More...
 
(FSGraphicsObjectArray *) - getGraphicsObjectsAtRectangle:filter:
 Get all the graphics objects whose rectangles intersect with a specified rectangle, with specified type filter.
More...
 
(float) - getHeight
 Get the page height (unit is 1/72 inch).
More...
 
(int) - getIndex
 Get page index.
More...
 
(FSPDFObject *) - getInheritedAttribute:
 Get the PDF object for specified attribute which may be inherited from the ancestor node in the page tree.
More...
 
(FSPDFDictionary *) - getResources
 Get the PDF dictionary of "Resources".
More...
 
(FSRectF *) - getSuggestedRect:render_matrix:point:
 Get the suggested rectangle (in PDF coordinate system) for a point (in [PDF coordinate system] (FSPDFPage)) based on the rendering result bitmap.
More...
 
(FSPDFStream *) - getThumb
 Get the PDF stream of "Thumb".
More...
 
(float) - getWidth
 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...
 
(id) - initWithDocument:page_dict:
 Constructor, from a PDF dictionary which represents a PDF page and the PDF document which contains the dictionary..
More...
 
(id) - initWithOther:
 Constructor, with parent class object.
More...
 
(BOOL) - isParsed
 Check if current page has been parsed or not.
More...
 
(FSBitmap *) - loadThumbnail
 Load the thumbnail bitmap.
More...
 
(void) - moveAnnotToFirst:
 Change specified annotation to be the first one of all annotations.
More...
 
(void) - moveAnnotToLast:
 Change specified annotation to be the last one of all annotations.
More...
 
(void) - moveAnnotToNext:
 Exchange the indexes of current annotation and its next annotation.
More...
 
(void) - moveAnnotToPrev:
 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:
 Remove an annotation.
More...
 
(BOOL) - setAnnotGroup:header_index:
 Group all the input markup annotations together.
More...
 
(void) - setBox:box:
 Set page box.
More...
 
(void) - setClipRect:
 Set clip rectangle for all graphics objects on current PDF page.
More...
 
(void) - setSize:height:
 Set page width and height.
More...
 
(void) - setSizeWithType:
 Set page size type.
More...
 
(void) - setThumbnail:
 Set page thumbnail.
More...
 
(FSProgressive *) - startParse:pause:is_reparse:
 Start to parse current page.
More...
 
(BOOL) - transform:need_transform_clip_path:need_transform_annotations:
 Transform a PDF page, including annotations and form fields on the page.
More...
 
(void) - updateAnnotList
 Update the annotation list.
More...
 
- Instance Methods inherited from FSGraphicsObjects
(BOOL) - generateContent
 Generate contents of current graphics objects.
More...
 
(BOOL) - generateContentWithMergeOption:
 Generate contents of current graphics objects.
More...
 
(long) - getFirstGraphicsObjectPosition:
 Get the position of first graphics object in graphics object list, based on type filter.
More...
 
(FSGraphicsObject *) - getGraphicsObject:
 Get the graphics object by position in graphics object list.
More...
 
(FSGraphicsObject *) - getGraphicsObjectByIndex:
 Get a graphics object by index.
More...
 
(int) - getGraphicsObjectCount
 Get the count of graphics objects in graphics object list.
More...
 
(int) - getGraphicsObjectIndex:
 Get the index of a specified graphics object in graphics object list.
More...
 
(long) - getGraphicsObjectPosition:
 Get the position of the specified graphics object.
More...
 
(long) - getLastGraphicsObjectPosition:
 Get the position of last graphics object in graphics object list, based on type filter.
More...
 
(long) - getNextGraphicsObjectPosition:filter:
 Get the position of next graphics object in graphics object list, based on type filter and specified current position.
More...
 
(long) - getPrevGraphicsObjectPosition:filter:
 Get the position of previous graphics object in graphics object list, based on type filter and specified current position.
More...
 
(long) - insertGraphicsObject:graphics_object:
 Insert a graphics object after the specified position.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(long) - moveGraphicsObjectByPosition:position_move_after:
 Move a graphics object from a position to another position.
More...
 
(BOOL) - removeGraphicsObject:
 Remove a graphics object.
More...
 
(BOOL) - removeGraphicsObjectByPosition:
 Remove a graphics object by position.
More...
 

Properties

FSRotation rotation
 Get or Set the page rotation.

 
float userUnitSize
 Get or Set the user unit.
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 FSPDFDoc::getPage:. For most case, a PDF page should be parsed first and then be used. Function FSPDFPage::isParsed can be used to judge whether the PDF page has been parsed or not. For a unparsed page, please use function FSPDFPage::startParse:pause:is_reparse: 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:

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

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 FSTextPage with PDF page object.
  • To do reflowing, please construct a FSReflowPage with PDF page object.
  • To access additional actions, please construct an FSAdditionalAction object with PDF page object.
  • To manage the tab order of annotations in PDF page, please construct a FSTabOrderMgr with PDF page object.


See also
FSPDFDoc
FSGraphicsObjects
FSTextPage
FSReflowPage
FSAdditionalAction
FSTabOrderMgr

Method Documentation

◆ addAnnot:rect:()

- (FSAnnot *) addAnnot: (FSAnnotType type
rect: (FSRectF*)  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 FSPDFPage::addSignature: can be called to add a new signature object.
    For other types of form field, function FSForm::addControl:field_name:field_type:rect: can be called to add a new form field (with form control).

  • PSInk annotation should be converted from a PSI object by function FSPSI::convertToPDFAnnot:annot_rect:rotate:.
  • Redact annotation should be added to mark areas in PDF page by function FSRedaction::markRedactAnnot:rects:.
  • For supported annotations types, if user does not set any properties of the newly created annotation (except the required properties) and directly calls function FSAnnot::resetAppearanceStream, default appearance will be used. Please refer to comment of concrete annotation class for more details of their own default appearance.


Parameters
[in]typeThe type of annotation to be added. Please refer to values starting from FSAnnotNote and this should be one of these values except FSAnnotPSInk, FSAnnotSound, FSAnnotMovie, FSAnnotWidget, FSAnnotPrinterMark, FSAnnotTrapNet, FSAnnotWatermark, FSAnnot3D.
[in]rectRectangle of the new annotation.
Returns
The newly created annotation object.

◆ addAnnotWithDictionary:()

- (FSAnnot *) addAnnotWithDictionary: (FSPDFDictionary*)  annot_dict

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

Parameters
[in]annot_dictAn valid annotation dictionary which is to be added as an annotation to current PDF page.
Returns
The newly created annotation object.

◆ addImage:frame_index:position:width:height:auto_generate_content:()

- (BOOL) addImage: (FSImage*)  image
frame_index: (int)  frame_index
position: (FSPointF*)  position
width: (float)  width
height: (float)  height
auto_generate_content: (BOOL)  auto_generate_content 

Add an image to current page.

If the type of image is FSImageJPG, the image should be kept valid until the related document is closed.

Parameters
[in]imageAn 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 FSImageUnknown.
[in]frame_indexFrame index. Valid range: from 0 to (count-1). count is returned by function FSImage::getFrameCount.
[in]positionA specified position which is the bottom left corner of image object, in PDF coordinate system.
[in]widthThe width which is used for the image to set into page (unit is 1/72 inch). The value should be larger than 0.
[in]heightThe 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_contentYES means to generate content internally.
When using NO, user should ensure to call function FSGraphicsObjects::generateContent after adding image. Please refer to function FSGraphicsObjects::generateContent for more details.
Returns
YES means success, while NO means failure.

◆ addImageFromFilePath:position:width:height:auto_generate_content:()

- (BOOL) addImageFromFilePath: (NSString *)  file_path
position: (FSPointF*)  position
width: (float)  width
height: (float)  height
auto_generate_content: (BOOL)  auto_generate_content 

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_pathA full path of an existing image file. It should not be an empty string.
[in]positionA specified position which is the bottom left corner of image object, in [PDF coordinate system] (FSPDFPage).
[in]widthThe width which is used for the image to set into page. The value should be larger than 0.
[in]heightThe height which is used for the image to set into page. The value should be larger than 0.
[in]auto_generate_contentYES means to generate content internally.
When using NO, user should ensure to call function FSGraphicsObjects::generateContent after adding image. Please refer to function FSGraphicsObjects::generateContent for more details.
Returns
YES means success, while NO means failure.

◆ addSignature:()

- (FSSignature *) addSignature: (FSRectF*)  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 FSSignature for more details about signature's filter and sub-filter.
Before signing the new signature, user can also call setting functions of class FSSignature to set other information used for signing and signed appearance.

Parameters
[in]rectRectangle 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.

◆ addSignatureWithExistedVDict:field_name:signature_type:to_check_permission:existed_signature:()

- (FSSignature *) addSignatureWithExistedVDict: (FSRectF*)  rect
field_name: (NSString *)  field_name
signature_type: (FSSignatureSignatureType signature_type
to_check_permission: (BOOL)  to_check_permission
existed_signature: (FSSignature*)  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 FSSignature for more details about signature's filter and sub- filter.
Before signing the new signature, user can also call setting functions of class FSSignature 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]rectRectangle position for the new signature, in PDF coordinate system. If parameter signature_type is FSSignatureSignatureTypeTimeStamp, this rectangle will be ignored; otherwise, this should be a valid rectangle in PDF coordinate system.
[in]field_nameThe signature field name. This can be an empty string.
[in]signature_typeSignature type. Please refer to values starting from FSSignatureSignatureTypeOrdinary and this should be one of these values.
[in]to_check_permissionA boolean value to decide whether Foxit PDF SDK should check PDF document's permission before adding signature: YES means Foxit PDF SDK should check document permission to decide if adding signature is allowed, while NO means Foxit PDF SDK should not check document permission before adding signature. When this parameter is NO, user should ensure to check document permission to check if adding signature is allowed. Default value: YES.
[in]existed_signatureThe signature whose "V" dictionary will be used in the newly added signature.
Returns
The newly added signature object.

◆ addSignatureWithFieldName:field_name:()

- (FSSignature *) addSignatureWithFieldName: (FSRectF*)  rect
field_name: (NSString *)  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 FSSignature for more details about signature's filter and sub-filter.
Before signing the new signature, user can also call setting functions of class FSSignature to set other information used for signing and signed appearance.

Parameters
[in]rectRectangle position for the new signature, in PDF coordinate system. It should be a valid rectangle in PDF coordinate system.
[in]field_nameThe signature field name. This can be an empty string.
Returns
The newly added signature object.

◆ addSignatureWithSignatureType:field_name:signature_type:to_check_permission:()

- (FSSignature *) addSignatureWithSignatureType: (FSRectF*)  rect
field_name: (NSString *)  field_name
signature_type: (FSSignatureSignatureType signature_type
to_check_permission: (BOOL)  to_check_permission 

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 FSSignature for more details about signature's filter and sub-filter.
Before signing the new signature, user can also call setting functions of class FSSignature to set other information used for signing and signed appearance.

Parameters
[in]rectRectangle position for the new signature, in PDF coordinate system. If parameter signature_type is FSSignatureSignatureTypeTimeStamp, this rectangle will be ignored; otherwise, this should be a valid rectangle in PDF coordinate system.
[in]field_nameThe signature field name. This can be an empty string.
[in]signature_typeSignature type. Please refer to values starting from FSSignatureSignatureTypeOrdinary and this should be one of these values.
[in]to_check_permissionA boolean value to decide whether Foxit PDF SDK should check PDF document's permission before adding signature: YES means Foxit PDF SDK should check document permission to decide if adding signature is allowed, while NO means Foxit PDF SDK should not check document permission before adding signature. When this parameter is NO, user should ensure to check document permission to check if adding signature is allowed.
Returns
The newly added signature object.

◆ addText:rect:style:disable_embed_font:()

- (BOOL) addText: (NSString *)  text
rect: (FSRectF*)  rect
style: (FSRichTextStyle*)  style
disable_embed_font: (BOOL)  disable_embed_font 

Add text to current page.

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

Parameters
[in]textContent of the new text string. This should not be an empty string.
[in]rectThe box rectangle, in PDF coordinate system.
[in]styleStyle data used for the new text string.
[in]disable_embed_fontA boolean value which indicates whether to disable embed font. YES means to disable embed font, while NO means not to.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ addTextWithRotation:rect:style:rotation:disable_embed_font:()

- (FSRectF *) addTextWithRotation: (NSString *)  text
rect: (FSRectF*)  rect
style: (FSRichTextStyle*)  style
rotation: (int)  rotation
disable_embed_font: (BOOL)  disable_embed_font 

Add text to current page.

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

Parameters
[in]textContent of the new text string. This should not be an empty string.
[in]rectThe box rectangle, in PDF coordinate system.
[in]styleStyle data used for the new text string.
[in]rotationThe rotation value for the new text string.
[in]disable_embed_fontA boolean value which indicates whether to disable embed font. YES means to disable embed font, while NO means not to.
Returns
The rectangle for the content of the text block.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ calcContentBBox:()

- (FSRectF *) calcContentBBox: (FSPDFPageCalcMarginMode mode

Calculate the content area of PDF page.

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

Parameters
[in]modeCalculation mode. It should be one of following values:
Returns
The minimal rectangle which contains the visible page content.

◆ clearRenderCache()

- (void) clearRenderCache

Clear render cache.

Returns
None.

◆ flatten:options:()

- (BOOL) flatten: (BOOL)  for_display
options: (unsigned int)  options 

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 FSAnnotFlagInvisible 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 FSPDFPage::startParse:pause:is_reparse:.

Parameters
[in]for_displayDecide the purpose of the flattened result: YES means the flatten result is used for display only, and NO means the flatten result is used for print only.
[in]optionsThe flatten options. Please refer to values starting from FSPDFPageFlattenAll and this should one or a combination of them.
Specially, if FSPDFPageFlattenNoAnnot and FSPDFPageFlattenNoFormControl are used together, that means nothing is to be flatten to page and this function will return YES directly.
Returns
YES means current page is flattened successfully, while NO means failure.

◆ flattenAnnot:()

- (BOOL) flattenAnnot: (FSAnnot*)  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 FSPDFPage::startParse:pause:is_reparse:.

Parameters
[in]annotAn annotation to be flattened and removed.
Returns
YES means success, while NO means failure.

◆ getAnnot:()

- (FSAnnot *) getAnnot: (int)  index

Get an annotation by index.

Parameters
[in]indexAnnotation index. Valid range: from 0 to (count-1). count is returned by function FSPDFPage::getAnnotCount.
Returns
An annotation object.

◆ getAnnotAtDevicePoint:tolerance:matrix:()

- (FSAnnot *) getAnnotAtDevicePoint: (FSPointF*)  position
tolerance: (float)  tolerance
matrix: (FSMatrix2D*)  matrix 

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 FSAnnotFlagNoView or FSAnnotFlagHidden or FSAnnotFlagInvisible will not be retrieved by this function.If the returned annotation has a flag FSAnnotFlagReadOnly,it cannot be modified.

Parameters
[in]positionThe specified position, in device coordinate system.
[in]toleranceTolerance value. Valid range: 0.0f to 30.0f.
[in]matrixThe transformation matrix. Usually this is returned by function FSPDFPage::getDisplayMatrix:top:width:height:rotate:. If this is nil, current function will have the same feature as function FSPDFPage::getAnnotAtPoint:tolerance:.
Returns
An annotation object. If the return value of function FSAnnot::isEmpty for the returned annotation object is YES, that means no PDF annotation can be found.

◆ getAnnotAtPoint:tolerance:()

- (FSAnnot *) getAnnotAtPoint: (FSPointF*)  position
tolerance: (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 FSAnnotFlagNoView or FSAnnotFlagHidden or FSAnnotFlagInvisible will not be retrieved by this function. If the returned annotation has a flag FSAnnotFlagReadOnly,it cannot be modified.

Parameters
[in]positionThe specified position, in PDF coordinate system.
[in]toleranceTolerance value. Valid range: 0.0f to 30.0f.
Returns
An annotation object. If the return value of function FSAnnot::isEmpty for the returned annotation object is YES, that means no PDF annotation can be found.

◆ getAnnotCount()

- (int) getAnnotCount

Get the count of annotations.

Returns
The count of annotations.

◆ getAnnots()

- (FSPDFArray *) getAnnots

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 nil.

◆ getAnnotsAtDevicePoint:tolerance:matrix:()

- (FSAnnotArray *) getAnnotsAtDevicePoint: (FSPointF*)  position
tolerance: (float)  tolerance
matrix: (FSMatrix2D*)  matrix 

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 FSAnnotFlagNoView or FSAnnotFlagHidden or FSAnnotFlagInvisible will not be retrieved by this function.
If the return annotation object of function FSAnnotArray::getAt: for the returned annotation array object has flag FSAnnotFlagReadOnly, that means the annotation cannot be modified.

Parameters
[in]positionThe specified position, in device coordinate system.
[in]toleranceTolerance value. Valid range: 0.0f to 30.0f.
[in]matrixThe transformation matrix. Usually this is returned by function FSPDFPage::getDisplayMatrix:top:width:height:rotate:. If this is nil, current function will have the same feature as function FSPDFPage::getAnnotAtPoint:tolerance:.
Returns
The array of annotation. If the return value of function FSAnnotArray::getSize for the returned annotation array object is 0, that means no PDF annotation can be found.

◆ getAnnotsAtPoint:tolerance:()

- (FSAnnotArray *) getAnnotsAtPoint: (FSPointF*)  position
tolerance: (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 FSAnnotFlagNoView or FSAnnotFlagHidden or FSAnnotFlagInvisible will not be retrieved by this function.
If the return annotation object of function FSAnnotArray::getAt: for the returned annotation array object has flag FSAnnotFlagReadOnly, that means the annotation cannot be modified.

Parameters
[in]positionThe specified position, in PDF coordinate system.
[in]toleranceTolerance value. Valid range: 0.0f to 30.0f.
Returns
The array of annotation. If the return value of function FSAnnotArray::getSize for the returned annotation array object is 0, that means no PDF annotation can be found.

◆ getBox:()

- (FSRectF *) getBox: (FSPDFPageBoxType box_type

Get page box.

Parameters
[in]box_typePage box type. Please refer to values starting from FSPDFPageMediaBox and this should be one of these values.
Returns
A box rectangle, in PDF coordinate system.

◆ getContents()

- (FSPDFObject *) getContents

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 nil.

◆ getDict()

- (FSPDFDictionary *) getDict

Get the page dictionary.

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

◆ getDisplayMatrix:top:width:height:rotate:()

- (FSMatrix2D *) getDisplayMatrix: (int)  left
top: (int)  top
width: (int)  width
height: (int)  height
rotate: (FSRotation rotate 

Get the display matrix of PDF page, from PDF coordinate system to targeted device coordinate system.

Parameters
[in]leftLeft position of the transformation area in device coordinate system, commonly in pixels.
[in]topTop position of the transformation area in device coordinate system, commonly in pixels.
[in]widthWidth of the transformation area in device coordinate system, commonly in pixels.
[in]heightHeight of the transformation area in device coordinate system, commonly in pixels.
[in]rotateRotation value. Please refer to values starting from FSRotation0 and this should be one of these values except FSRotationUnknown.
Returns
The display matrix used for current PDF page.

◆ getDocument()

- (FSPDFDoc *) getDocument

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

Returns
A PDF document object.

◆ getGraphicsObjectAtDevicePoint:tolerance:matrix:filter:()

- (FSGraphicsObject *) getGraphicsObjectAtDevicePoint: (FSPointF*)  point
tolerance: (float)  tolerance
matrix: (FSMatrix2D*)  matrix
filter: (FSGraphicsObjectType filter 

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

Parameters
[in]pointA specified position, in device coordinate system.
[in]toleranceTolerance value for a graphics object hit detection, in point units. It should be positive.
[in]matrixThe transformation matrix. Usually this is returned by function FSPDFPage::getDisplayMatrix:top:width:height:rotate:.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
A FSGraphicsObject object. If no graphics object can be found, this function will return nil.

◆ getGraphicsObjectAtPoint:tolerance:filter:()

- (FSGraphicsObject *) getGraphicsObjectAtPoint: (FSPointF*)  point
tolerance: (float)  tolerance
filter: (FSGraphicsObjectType filter 

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

Parameters
[in]pointA specified position, in PDF coordinate system.
[in]toleranceTolerance value for a graphics object hit detection, in point units. It should be positive.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
A FSGraphicsObject object. If no graphics object can be found, this function will return nil.

◆ getGraphicsObjectAtRectangle:filter:()

- (FSGraphicsObject *) getGraphicsObjectAtRectangle: (FSRectF*)  rect
filter: (FSGraphicsObjectType filter 

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

Parameters
[in]rectA specified rectangle, in PDF coordinate system.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
A graphics object whose rectangle intersects with the specified rectangle. If no suitable graphics object can be found, this function will return nil.

◆ getGraphicsObjectsAtDevicePoint:tolerance:matrix:filter:()

- (FSGraphicsObjectArray *) getGraphicsObjectsAtDevicePoint: (FSPointF*)  point
tolerance: (float)  tolerance
matrix: (FSMatrix2D*)  matrix
filter: (FSGraphicsObjectType filter 

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

Parameters
[in]pointA specified position, in device coordinate system.
[in]toleranceTolerance value for a graphics object hit detection, in point units. It should be positive.
[in]matrixThe transformation matrix. Usually this is returned by function FSPDFPage::getDisplayMatrix:top:width:height:rotate:.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
An array of FSGraphicsObject objects.

◆ getGraphicsObjectsAtPoint:tolerance:filter:()

- (FSGraphicsObjectArray *) getGraphicsObjectsAtPoint: (FSPointF*)  point
tolerance: (float)  tolerance
filter: (FSGraphicsObjectType filter 

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

Parameters
[in]pointA specified position, in PDF coordinate system.
[in]toleranceTolerance value for a graphics object hit detection, in point units. It should be positive.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
An array of FSGraphicsObject objects.

◆ getGraphicsObjectsAtRectangle:filter:()

- (FSGraphicsObjectArray *) getGraphicsObjectsAtRectangle: (FSRectF*)  rect
filter: (FSGraphicsObjectType filter 

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

Parameters
[in]rectA specified rectangle, in PDF coordinate system.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
An array of graphics objects whose rectangle intersect with the specified rectangle.

◆ getHeight()

- (float) getHeight

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

Returns
Page height.

◆ getIndex()

- (int) getIndex

Get page index.

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

◆ getInheritedAttribute:()

- (FSPDFObject *) getInheritedAttribute: (NSString *)  attruibute_name

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_nameThe name of attribute to be found.
Returns
A PDF object. If not found, this function will return nil.

◆ getResources()

- (FSPDFDictionary *) getResources

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 nil.

◆ getSuggestedRect:render_matrix:point:()

- (FSRectF *) getSuggestedRect: (FSBitmap*)  render_result
render_matrix: (FSMatrix2D*)  render_matrix
point: (FSPointF*)  point 

Get the suggested rectangle (in PDF coordinate system) for a point (in [PDF coordinate system] (FSPDFPage)) 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_resultBitmap as the result of rendering current PDF page. This should be a valid bitmap object.
[in]render_matrixThe transformation matrix used for rendering current PDF page and generating parameter render_result as rendering result.
[in]pointA 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 YES, that means no suitable suggested rectangle can be found.

◆ getThumb()

- (FSPDFStream *) getThumb

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 nil.

◆ getWidth()

- (float) getWidth

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

Returns
Page width.

◆ hasTransparency()

- (BOOL) hasTransparency

Check whether current PDF page has transparency or not.

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

Returns
YES means current page has transparency, while NO means current page does not have transparency.

◆ hasWatermark()

- (BOOL) 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
YES means the current page has watermark, and NO means the current page has no watermark.

◆ initWithDocument:page_dict:()

- (id) initWithDocument: (FSPDFDoc*)  document
page_dict: (FSPDFDictionary*)  page_dict 

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

Parameters
[in]documentA valid PDF document.
[in]page_dictA PDF dictionary of a PDF page. It should belong to the PDF document specified by parameter document.

◆ initWithOther:()

- (id) initWithOther: (FSGraphicsObjects*)  other

Constructor, with parent class object.

Parameters
[in]otherParent class object.

Reimplemented from FSGraphicsObjects.

◆ isParsed()

- (BOOL) isParsed

Check if current page has been parsed or not.

Returns
YES means current page has been parsed, while NO means current page has not been parsed yet.

◆ loadThumbnail()

- (FSBitmap *) loadThumbnail

Load the thumbnail bitmap.

Returns
The thumbnail bitmap of current page. If the return value of function FSBitmap::isEmpty for the returned bitmap object is YES, that means no thumbnail can be found.

◆ moveAnnotToFirst:()

- (void) moveAnnotToFirst: (FSAnnot*)  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]annotAn annotation object to be moved to first. It should be in current PDF page.
Returns
None.

◆ moveAnnotToLast:()

- (void) moveAnnotToLast: (FSAnnot*)  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]annotAn annotation object to be moved to last. It should be in current PDF page.
Returns
None.

◆ moveAnnotToNext:()

- (void) moveAnnotToNext: (FSAnnot*)  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]annotAn annotation object to be moved. It should be in current PDF page.
Returns
None.

◆ moveAnnotToPrev:()

- (void) moveAnnotToPrev: (FSAnnot*)  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]annotAn annotation object to be moved. It should be in current PDF page.
Returns
None.

◆ normalize()

- (BOOL) normalize

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

Returns
YES means success, while NO 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) removeAllWatermarks

Remove all watermarks.

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

Returns
YES means success, while NO means failure.

◆ removeAnnot:()

- (BOOL) removeAnnot: (FSAnnot*)  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 FSErrUnsupported.
For a widget annotation associated with a form field, please call function FSForm::removeControl: to remove it along with associated form control.

Parameters
[in]annotAn annotation object to be removed. It should be in current PDF page.
Returns
YES means success, while NO means failure.

◆ setAnnotGroup:header_index:()

- (BOOL) setAnnotGroup: (FSMarkupArray*)  annot_array
header_index: (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_arrayAn 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_indexThe 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
YES means group input markup annotations together successfully, while NO means failure.

◆ setBox:box:()

- (void) setBox: (FSPDFPageBoxType box_type
box: (FSRectF*)  box 

Set page box.

Parameters
[in]box_typePage box type. Please refer to values starting from FSPDFPageMediaBox and this should be one of these values.
[in]boxNew box rectangle, in PDF coordinate system.
Returns
None.

◆ setClipRect:()

- (void) setClipRect: (FSRectF*)  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 FSPDFPage::startParse:pause:is_reparse: with parameter is_reparse YES.

Parameters
[in]clip_rectNew clip rectangle, in PDF coordinate system.
Returns
None.

◆ setSize:height:()

- (void) setSize: (float)  width
height: (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]widthNew page width. It should be a positive value and the unit is 1/72 inch.
[in]heightNew page height. It should be a positive value and the unit is 1/72 inch.
Returns
None.

◆ setSizeWithType:()

- (void) setSizeWithType: (FSPDFPageSize 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]sizeSize type to specify the new size of current page. Please refer to values starting from FSPDFPageSizeLetter and this should be one of these values.
Returns
None.

◆ setThumbnail:()

- (void) setThumbnail: (FSBitmap*)  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 FSBitmapDIBRgb565.

Parameters
[in]thumbnailNew page thumbnail. It should be a valid bitmap.
Returns
None.

◆ startParse:pause:is_reparse:()

- (FSProgressive *) startParse: (unsigned int)  flags
pause: (id<FSPauseCallback>)  pause
is_reparse: (BOOL)  is_reparse 

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.

Parameters
[in]flagsParsing flags. Please refer to values starting from FSPDFPageParsePageNormal and this should be one or a combination of these values.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
[in]is_reparseYES means to re-parse current page, while NO means not to re-parse current page.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.
Note
When parameter is_reparse is set to YES, that means to re-parse current PDF page, and all the retrieved graphics object's position (as POSITION object) and graphics object (as FSGraphicsObject object) will be invalid.
Application needs to get graphics objects again after re-parsing a PDF page.

◆ transform:need_transform_clip_path:need_transform_annotations:()

- (BOOL) transform: (FSMatrix2D*)  matrix
need_transform_clip_path: (BOOL)  need_transform_clip_path
need_transform_annotations: (BOOL)  need_transform_annotations 

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 FSPDFPage::startParse:pause:is_reparse: with parameter is_reparse YES, in order that expected content will be displayed.
Parameters
[in]matrixTransform matrix.
[in]need_transform_clip_pathYES means to transform the page with clip rectangle, while NO means not.
[in]need_transform_annotationsYES means to transform the page with annotations. while NO means not.
Returns
YES means success, while NO means failure.

◆ updateAnnotList()

- (void) 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.

Property Documentation

◆ userUnitSize

- (float) userUnitSize
readwritenonatomicassign

Get or 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.