Foxit PDF SDK
|
Public Member Functions | |
Annot () | |
Constructor. | |
Annot (const Annot &annot) | |
Constructor, with another annotation object. More... | |
Annot (const PDFPage &page, objects::PDFDictionary *annot_dict) | |
Constructor, with PDF page and annotation's PDF dictionary. More... | |
virtual | ~Annot () |
Destructor. | |
objects::PDFStream * | GetAppearanceStream (AppearanceType type, const char *appearance_state="") const |
Get annotation's appearance stream with specified type and state. More... | |
RGB | GetBorderColor () const |
Get border color. More... | |
BorderInfo | GetBorderInfo () const |
Get border information. More... | |
WString | GetContent () const |
Get content. More... | |
RectI | GetDeviceRect (const Matrix &matrix) |
Get annotation rectangle in device coordinate system. More... | |
objects::PDFDictionary * | GetDict () const |
Get annotation's dictionary object. More... | |
Matrix | GetDisplayMatrix (const Matrix &page_display_matrix) |
Get the display matrix, from PDF coordinate system to targeted device coordinate system. More... | |
uint32 | GetFlags () const |
Get annotation flags. More... | |
int | GetIndex () const |
Get the index of current annotation in the page which current annotation belongs to. More... | |
DateTime | GetModifiedDateTime () const |
Get last modified date time. More... | |
objects::PDFDictionary * | GetOptionalContent () const |
Get the PDF dictionary of annotation's optional content. More... | |
PDFPage | GetPage () const |
Get the related PDF page. More... | |
RectF | GetRect () const |
Get rectangle, in PDF coordinate system. More... | |
Type | GetType () const |
Get actual annotation type of current annotation. More... | |
WString | GetUniqueID () const |
Get unique ID. More... | |
bool | HasProperty (Property property) const |
Whether current annotation has the specified annotation's property. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | IsMarkup () const |
Check if current annotation is a markup annotation. More... | |
bool | Move (const RectF &rect) |
Move current annotation to a new position, specified by a new rectangle in PDF coordinate system. More... | |
bool | Move (const RectF &rect, bool is_reset_appearance) |
Move current annotation to a new position, specified by a new rectangle in PDF coordinate system. More... | |
bool | operator!= (const Annot &other) const |
Not equal operator. More... | |
Annot & | operator= (const Annot &annot) |
Assign operator. More... | |
bool | operator== (const Annot &other) const |
Equal operator. More... | |
bool | RemoveProperty (Property property) |
Remove a specified annotation's property. More... | |
bool | ResetAppearanceStream () |
Reset appearance stream. More... | |
bool | ResetAppearanceStream (bool is_generate_new_appearance_obj) |
Reset appearance stream. More... | |
void | SetBorderColor (RGB color) |
Set border color. More... | |
void | SetBorderInfo (const BorderInfo &border) |
Set border information. More... | |
void | SetContent (const WString &content) |
Set content. More... | |
void | SetFlags (uint32 flags) |
Set annotation flags. More... | |
void | SetModifiedDateTime (const DateTime &date_time) |
Set last modified date time. More... | |
void | SetUniqueID (const WString &unique_id) |
Set unique ID. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
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 Annot 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:
Enumeration for PDF annotation flags.
Values of this enumeration can be used alone or in combination.
Enumerator | |
---|---|
e_FlagInvisible | Annotation flag: invisible. If set, do not display the annotation if it does not belong to one of the standard annotation types and no annotation handler is available. If clear, display such an non-standard annotation using an appearance stream specified by its appearance dictionary, if any. |
e_FlagHidden | Annotation flag: hidden. If set, do not display or print the annotation or allow it to interact with the user, regardless of its annotation type or whether an annotation handler is available. |
e_FlagPrint | Annotation flag: print. If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of whether it is displayed on the screen. This can be useful, for example, for annotations representing interactive pushbuttons, which would serve no meaningful purpose on the printed page. |
e_FlagNoZoom | Annotation flag: no zoom. If set, do not scale the annotation's appearance to match the magnification of the page. The location of the annotation on the page (defined by the upper-left corner of its annotation rectangle) remains fixed, regardless of the page magnification. |
e_FlagNoRotate | Annotation flag: no rotate. If set, do not rotate the annotation's appearance to match the rotation of the page. The upper-left corner of the annotation rectangle remains in a fixed location on the page, regardless of the page rotation. |
e_FlagNoView | Annotation flag: no view. If set, do not display the annotation on the screen or allow it to interact with the user. The annotation may be printed (depending on the setting of flag Annot::e_FlagPrint) but should be considered hidden for purposes of on-screen display and user interaction. |
e_FlagReadOnly | Annotation flag: read only. If set, do not allow the annotation to interact with the user. The annotation may be displayed or printed (depending on the settings of flags Annot::e_FlagNoView and Annot::e_FlagPrint) but should not respond to mouse clicks or change its appearance in response to mouse motions.
|
e_FlagLocked | Annotation flag: locked. If set, do not allow the annotation to be deleted or its properties (including position and size) to be modified by the user. However, this flag does not restrict changes to the annotation's contents, such as the value of a form field. |
e_FlagToggleNoView | Annotation flag: toggle no view. If set, invert the interpretation of the NoView flag for certain events. A typical use is to have an annotation that appears only when a mouse cursor is held over it. |
e_FlagLockedContents | Annotation flag: locked contents. If set, do not allow the contents of the annotation to be modified by the user. This flag does not restrict deletion of the annotation or changes to other annotation properties, such as position and size. |
Enumeration for PDF annotation highlighting mode.
Values of this enumeration should be used alone.
Enumeration for annotation's MK dictionary (an appearance characteristics) entry.
Values of this enumeration should be used alone.
Enumeration for icon and caption relative position in annotation's MK dictionary.
Values of this enumeration should be used alone.
Enumeration for some PDF annotation property.
Values of this enumeration should be used alone.
Enumeration for PDF annotation type.
Values of this enumeration should be used alone.
foxit::pdf::annots::Annot::Annot | ( | const PDFPage & | page, |
objects::PDFDictionary * | annot_dict | ||
) |
Constructor, with PDF page and annotation's PDF dictionary.
[in] | page | A valid PDF page. |
[in] | annot_dict | An annotation's PDF dictionary. It should represent an annotation and should be in the PDF page specified by parameter page. |
foxit::pdf::annots::Annot::Annot | ( | const Annot & | annot | ) |
Constructor, with another annotation object.
[in] | annot | Another annotation object. |
objects::PDFStream* foxit::pdf::annots::Annot::GetAppearanceStream | ( | AppearanceType | type, |
const char * | appearance_state = "" |
||
) | const |
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>.
[in] | type | Type of annotation's appearance. Please refer to values starting from Annot::e_AppearanceTypeNormal and this should be one of these values. |
[in] | appearance_state | Annotation'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. |
RGB foxit::pdf::annots::Annot::GetBorderColor | ( | ) | const |
Get border color.
This property has effect on annotation's appearance.
BorderInfo foxit::pdf::annots::Annot::GetBorderInfo | ( | ) | const |
Get 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 = BorderInfo::e_Solid, 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 Annot), 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.
WString foxit::pdf::annots::Annot::GetContent | ( | ) | const |
Get content.
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.
[in] | matrix | A matrix used to transform from PDF coordinate system to device coordinate system. Usually, this is returned by function pdf::PDFPage::GetDisplayMatrix and also used for rendering. |
objects::PDFDictionary* foxit::pdf::annots::Annot::GetDict | ( | ) | const |
Get annotation's dictionary object.
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.
[in] | page_display_matrix | The transformation matrix. Usually this is returned by function PDFPage::GetDisplayMatrix. |
uint32 foxit::pdf::annots::Annot::GetFlags | ( | ) | const |
Get annotation flags.
int foxit::pdf::annots::Annot::GetIndex | ( | ) | const |
Get the index of current annotation in the page which current annotation belongs to.
DateTime foxit::pdf::annots::Annot::GetModifiedDateTime | ( | ) | const |
Get last modified date time.
objects::PDFDictionary* foxit::pdf::annots::Annot::GetOptionalContent | ( | ) | const |
Get the PDF dictionary of annotation's optional content.
PDFPage foxit::pdf::annots::Annot::GetPage | ( | ) | const |
Get the related PDF page.
RectF foxit::pdf::annots::Annot::GetRect | ( | ) | const |
Get rectangle, in PDF coordinate system.
Type foxit::pdf::annots::Annot::GetType | ( | ) | const |
Get actual annotation type of current annotation.
WString foxit::pdf::annots::Annot::GetUniqueID | ( | ) | const |
Get unique ID.
bool foxit::pdf::annots::Annot::HasProperty | ( | Property | property | ) | const |
Whether current annotation has the specified annotation's property.
[in] | property | Property name. Please refer to values starting from Annot::e_PropertyModifiedDate and this should be one of these values. |
bool foxit::pdf::annots::Annot::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::pdf::annots::Annot::IsMarkup | ( | ) | const |
Check if current annotation is a markup annotation.
bool foxit::pdf::annots::Annot::Move | ( | const RectF & | rect | ) |
Move current annotation to a new position, specified by a new rectangle in PDF coordinate system.
[in] | rect | New rectangle to specify the new position where current annotation is to be moved to. It should be valid in PDF coordinate system. |
bool foxit::pdf::annots::Annot::Move | ( | const RectF & | rect, |
bool | is_reset_appearance | ||
) |
Move current annotation to a new position, specified by a new rectangle in PDF coordinate system.
[in] | rect | New 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_appearance | A boolean value specifies whether to reset annotation's appearance after moving. |
bool foxit::pdf::annots::Annot::operator!= | ( | const Annot & | other | ) | const |
Not equal operator.
[in] | other | Another annotation object. This function will check if current object is not equal to this one. |
Assign operator.
[in] | annot | Another annotation object, whose value would be assigned to current object. |
bool foxit::pdf::annots::Annot::operator== | ( | const Annot & | other | ) | const |
Equal operator.
[in] | other | Another annotation object. This function will check if current object is equal to this one. |
bool foxit::pdf::annots::Annot::RemoveProperty | ( | Property | 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 Annot::e_PropertyBorderColor and Annot::e_PropertyFillColor, user should call function Annot::ResetAppearanceStream to make effect on annotation's appearance.
[in] | property | Property name. Please refer to values starting from Annot::e_PropertyModifiedDate and this should be one of these values. |
bool foxit::pdf::annots::Annot::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 Annot 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.
bool foxit::pdf::annots::Annot::ResetAppearanceStream | ( | 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 Annot 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.
[in] | is_generate_new_appearance_obj | true means to generate a new appearance object to reset the appearance of the current annotation, while false means to reset the appearance of annotations that share this appearance stream. The parameter has only effect on widget annotation's appearance. |
void foxit::pdf::annots::Annot::SetBorderColor | ( | RGB | color | ) |
Set border color.
This property has effect on annotation's appearance. If user wants the new border color has effect on annotation's appearance, please call function Annot::ResetAppearanceStream after setting the new border color.
[in] | color | New border color to be set. Format: 0xRRGGBB. |
void foxit::pdf::annots::Annot::SetBorderInfo | ( | const BorderInfo & | border | ) |
Set border information.
This property has effect on annotation's appearance. If user wants the new border information has effect on annotation's appearance, please call function Annot::ResetAppearanceStream after setting the new border information.
Attention: among supported annotation types (please refer to "Note" comment part of class Annot), 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.
[in] | border | New border information to be set. It should be a valid border information object. If any value of parameter border is invalid, this function will fail to set new border information to current annotation. |
void foxit::pdf::annots::Annot::SetContent | ( | const WString & | content | ) |
Set content.
For free text annotation and line annotation (which has enabled caption), they would show content in their appearance. So for these kinds of annotations, this property would have effect on annotation's appearance. If user wants the effect to be shown in the appearance of these kind of annotations, please call function Annot::ResetAppearanceStream after setting new content.
[in] | content | New content string to be set. |
void foxit::pdf::annots::Annot::SetFlags | ( | uint32 | flags | ) |
Set annotation flags.
[in] | flags | The annotation flags. It could be 0, or one or a combination of values starting from Annot::e_FlagInvisible. |
void foxit::pdf::annots::Annot::SetModifiedDateTime | ( | const DateTime & | date_time | ) |
Set last modified date time.
[in] | date_time | The data time to be set. It should contain valid date time data. |
void foxit::pdf::annots::Annot::SetUniqueID | ( | const WString & | unique_id | ) |
Set unique ID.
[in] | unique_id | New unique ID string to be set. |