Foxit PDF SDK
FSAnnot Class Reference
Inheritance diagram for FSAnnot:
FSBase FSLink FSMarkup FSPopup FSPSInk FSScreen FSWidget FSCaret FSCircle FSFileAttachment FSFreeText FSInk FSLine FSNote FSPolygon FSPolyLine FSRedact FSSound FSSquare FSStamp FSTextMarkup

Instance Methods

(BOOL) - FSMoveWithResetAppearance:is_reset_appearance:
 Move current annotation to a new position, specified by a new rectangle in PDF coordinate system.
More...
 
(BOOL) - FSResetApStreamWithIsGenerateNewAppearanceObj:
 Reset appearance stream.
More...
 
(FSPDFStream *) - getAppearanceStream:appearance_state:
 Get annotation's appearance stream with specified type and state.
More...
 
(FSRectI *) - getDeviceRect:
 Get annotation rectangle in device coordinate system.
More...
 
(FSPDFDictionary *) - getDict
 Get annotation's dictionary object.
More...
 
(FSMatrix2D *) - getDisplayMatrix:
 Get the display matrix, from PDF coordinate system to targeted device coordinate system.
More...
 
(int) - getIndex
 Get the index of current annotation in the page which current annotation belongs to.
More...
 
(FSPDFDictionary *) - getOptionalContent
 Get the PDF dictionary of annotation's optional content.
More...
 
(FSPDFPage *) - getPage
 Get the related PDF page.
More...
 
(FSRectF *) - getRect
 Get rectangle, in PDF coordinate system.
More...
 
(FSAnnotType- getType
 Get actual annotation type of current annotation.
More...
 
(BOOL) - hasProperty:
 Whether current annotation has the specified annotation's property.
More...
 
(id) - initWithAnnot:
 Constructor, with another annotation object.
More...
 
(id) - initWithPage:annot_dict:
 Constructor, with PDF page and annotation's PDF dictionary.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(BOOL) - isMarkup
 Check if current annotation is a markup annotation.
More...
 
(BOOL) - move:
 Move current annotation to a new position, specified by a new rectangle in PDF coordinate system.
More...
 
(BOOL) - removeProperty:
 Remove a specified annotation's property.
More...
 
(BOOL) - resetAppearanceStream
 Reset appearance stream.
More...
 

Properties

unsigned int borderColor
 Get or Set border color.
More...
 
FSBorderInfoborderInfo
 Get or Set border information.
More...
 
NSString * content
 Get or Set content.

 
unsigned int flags
 Get or Set annotation flags.

 
FSDateTimemodifiedDateTime
 Get or Set last modified date time.

 
NSString * uniqueID
 Get or Set unique ID.

 

Detailed Description

An annotation associates an object such as a note, sound, or movie with a location on a page of a PDF document, or provides a way to interact with the user by means of the mouse and keyboard. PDF includes a wide variety of standard annotation types.
Class FSAnnot is the base class for all kinds of PDF annotations. It offers the base functions to get/set annotation's common properties, to move an annotation or reset appearance stream of an annotation. For concrete annotation types, please refer to derived classes. To get the count of annotations or get/add/remove an annotation, please refer to class pdf::PDFPage.
This class object can also be used to construct objects of other classes in order to do some more operation in annotation or access specified information of annotation:

  • To access additional actions, please construct an FSAdditionalAction object with annotation object. Only a few types of annotations may have additional action. For more details, please refer to class FSAdditionalAction.
  • To search text in annotation, please construct a FSTextSearch object with annotation object. The searching can only support some types of annotations. For more details, please refer to class FSTextSearch.


Note
Currently, following kind of functions only support note, highlight, underline, strikeout, squiggly, link, square, circle, free text, stamp, caret, ink, line, polygon, polyline, file attachment, pop-up, widget, screen, PSInk, redact annotations:
See also
FSPDFPage
FSAdditionalAction
FSTextSearch

Method Documentation

◆ FSMoveWithResetAppearance:is_reset_appearance:()

- (BOOL) FSMoveWithResetAppearance: (FSRectF*)  rect
is_reset_appearance: (BOOL)  is_reset_appearance 

Move current annotation to a new position, specified by a new rectangle in PDF coordinate system.

Parameters
[in]rectNew rectangle to specify the new position where current annotation is to be moved to. It should be valid in PDF coordinate system".
[in]is_reset_appearanceA boolean value specifies whether to reset annotation's appearance after moving.
Returns
YES means success, while NO means failure.

◆ FSResetApStreamWithIsGenerateNewAppearanceObj:()

- (BOOL) FSResetApStreamWithIsGenerateNewAppearanceObj: (BOOL)  is_generate_new_appearance_obj

Reset appearance stream.

Annotation's appearance is stored as stream in PDF document. Any appearance-related property can be changed through the corresponding setting functions. For this change to take effect, this function should be called to update the annotation's appearance.
Please check "Note" part in the comment of class FSAnnot to see which types of annotations can be reset appearance by current function and also check comment in classes of these annotations to see if any property is required before resetting appearance stream.

Parameters
[in]is_generate_new_appearance_objYES means to generate a new appearance object to reset the appearance of the current annotation, while NO means to reset the appearance of annotations that share this appearance stream. The parameter has only effect on widget annotation's appearance.
Returns
YES means success, while NO means failure.

◆ getAppearanceStream:appearance_state:()

- (FSPDFStream *) getAppearanceStream: (FSAnnotAppearanceType type
appearance_state: (NSString *)  appearance_state 

Get annotation's appearance stream with specified type and state.

For more details, please refer to "AP" and "AS" entries in "TABLE 8.15 Entries common to all annotation dictionaries" in <PDF reference 1.7>.

Parameters
[in]typeType of annotation's appearance. Please refer to values starting from FSAnnotAppearanceTypeNormal and this should be one of these values.
[in]appearance_stateAnnotation's appearance state, which is used to select the applicable appearance stream from an appearance sub- dictionary. If this is an empty string, Foxit PDF SDK will choose the appearance state specified by the "AS" (Appearance State) entry in the annotation dictionary.
Returns
The specified annotation's appearance stream. If there is no entry which related to appearance or any error occurs, this function will return nil.

◆ getDeviceRect:()

- (FSRectI *) getDeviceRect: (FSMatrix2D*)  matrix

Get annotation rectangle in device coordinate system.

This is a useful function to get the device rectangle of an annotation, but not support pop-up annotation.
For the rectangle conversion, the result rectangle is always "normalized", which is using device coordinate system: left is always smaller than right, and top is always smaller than bottom.

Parameters
[in]matrixA matrix used to transform from PDF coordinate system to device coordinate system. Usually, this is returned by function pdf::PDFPage::getDisplayMatrix:top:width:height:rotate: and also used for rendering.
Returns
The annotation rectangle in device coordinate system. If there is no rectangle information, a RectI object with all 0 values would be returned.

◆ getDict()

- (FSPDFDictionary *) getDict

Get annotation's dictionary object.

Returns
Annotation's dictionary. If there is any error, this function will return nil.

◆ getDisplayMatrix:()

- (FSMatrix2D *) getDisplayMatrix: (FSMatrix2D*)  page_display_matrix

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

Display matrix of current annotation can be used with annotation's rectangle to calculate the real area of annotation in target device coordinate system.

Parameters
[in]page_display_matrixThe transformation matrix. Usually this is returned by function PDFPage::getDisplayMatrix:top:width:height:rotate:.
Returns
The display matrix of current annotation.

◆ getIndex()

- (int) getIndex

Get the index of current annotation in the page which current annotation belongs to.

Returns
The index value, starting from 0.

◆ getOptionalContent()

- (FSPDFDictionary *) getOptionalContent

Get the PDF dictionary of annotation's optional content.

Returns
The PDF dictionary of annotation's optional content. If there is no "OC" entry or any error occurs, this function will return nil.

◆ getPage()

- (FSPDFPage *) getPage

Get the related PDF page.

Returns
A PDF page object which is the related PDF page.

◆ getRect()

- (FSRectF *) getRect

Get rectangle, in PDF coordinate system.

Returns
The annotation rectangle. If there is no rectangle information, a RectF object with all 0 values would be returned.

◆ getType()

- (FSAnnotType) getType

Get actual annotation type of current annotation.

Returns
Annotation type. Please refer to values starting from FSAnnotNote and this would be one of these values.

◆ hasProperty:()

- (BOOL) hasProperty: (FSAnnotProperty property

Whether current annotation has the specified annotation's property.

Parameters
[in]propertyProperty name. Please refer to values starting from FSAnnotPropertyModifiedDate and this should be one of these values.
Returns
YES means current annotation has the specified property, while NO means current annotation does not have the specified property.

◆ initWithAnnot:()

- (id) initWithAnnot: (FSAnnot*)  annot

Constructor, with another annotation object.

Parameters
[in]annotAnother annotation object.

Reimplemented in FSRedact, FSSound, FSWidget, FSPopup, FSPSInk, FSFileAttachment, FSCaret, FSPolyLine, FSPolygon, FSScreen, FSStamp, FSInk, FSLine, FSFreeText, FSCircle, FSSquare, FSLink, FSTextMarkup, FSHighlight, FSUnderline, FSStrikeOut, FSSquiggly, FSNote, and FSMarkup.

◆ initWithPage:annot_dict:()

- (id) initWithPage: (FSPDFPage*)  page
annot_dict: (FSPDFDictionary*)  annot_dict 

Constructor, with PDF page and annotation's PDF dictionary.

Parameters
[in]pageA valid PDF page.
[in]annot_dictAn annotation's PDF dictionary. It should represent an annotation and should be in the PDF page specified by parameter page.

◆ isEmpty()

- (BOOL) isEmpty

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
YES means current object is empty, while NO means not.

◆ isMarkup()

- (BOOL) isMarkup

Check if current annotation is a markup annotation.

Returns
YES means current annotation is a markup annotation, while NO means current annotation is not a markup annotation.

◆ move:()

- (BOOL) move: (FSRectF*)  rect

Move current annotation to a new position, specified by a new rectangle in PDF coordinate system.

Parameters
[in]rectNew rectangle to specify the new position where current annotation is to be moved to. It should be valid in PDF coordinate system".
Returns
YES means success, while NO means failure.

◆ removeProperty:()

- (BOOL) removeProperty: (FSAnnotProperty property

Remove a specified annotation's property.

This function can be used to remove some optional properties of an annotation. When appearance related property is removed successfully, such as FSAnnotPropertyBorderColor and FSAnnotPropertyFillColor, user should call function Annot::resetAppearanceStream to make effect on annotation's appearance.

Parameters
[in]propertyProperty name. Please refer to values starting from FSAnnotPropertyModifiedDate and this should be one of these values.
Returns
YES means remove the specified property successfully, or current annotation supports the property but does not have the property.
NO means current annotation does not support to have the specified property, or current annotation cannot be removed specified property.

◆ resetAppearanceStream()

- (BOOL) resetAppearanceStream

Reset appearance stream.

Annotation's appearance is stored as stream in PDF document. Any appearance-related property can be changed through the corresponding setting functions. For this change to take effect, this function should be called to update the annotation's appearance.
Please check "Note" part in the comment of class FSAnnot to see which types of annotations can be reset appearance by current function and also check comment in classes of these annotations to see if any property is required before resetting appearance stream.

Returns
YES means success, while NO means failure.

Property Documentation

◆ borderColor

- (unsigned int) borderColor
readwritenonatomicassign

Get or Set border color.

This property has effect on annotation's appearance.

◆ borderInfo

- (FSBorderInfo *) borderInfo
readwritenonatomicweak

Get or Set border information.

This property has effect on annotation's appearance. For an annotation which does not have border information, the default border information will be returned:
border width = 1, border style = FSBorderInfoSolid, border cloud intensity = 0, border dash phase = 0, border dashes array is an empty array. Attention: among supported annotation types (please refer to "Note" comment part of class FSAnnot ), this property will not have effect on appearance of these annotations: note, highlight, underline, strikeout, squiggly, stamp, caret, popup, file attachment, PSInk, redact. For ink annotation, only border width will have effect on ink annotation's appearance.