Foxit PDF SDK
fsdk.Markup Class Reference

Public Member Functions

def AddReply ()
 Add a new reply to the end of reply list.
More...
 
def AddRichText (content, style)
 Add a new rich text string to the end.
More...
 
def AddStateAnnot (title, model, state)
 Add a new state annotation.
More...
 
def GetBorderOpacity ()
 Get the border opacity of the annotation.
More...
 
def GetCreationDateTime ()
 Get creation date time.
More...
 
def GetFillOpacity ()
 Get the fill opacity of the annotation.
More...
 
def GetGroupElements ()
 Get an element (as markup annotation) from the group that current markup annotation belongs to.
More...
 
def GetGroupHeader ()
 Get the header annotation (as primary annotation) of the group that current markup annotation belongs to.
More...
 
def GetIntent ()
 Get intent name.
More...
 
def GetOpacity ()
 Get opacity value.
More...
 
def GetPopup ()
 Get related pop-up annotation.
More...
 
def GetReply (index)
 Get a reply by index.
More...
 
def GetReplyCount ()
 Count all replies.
More...
 
def GetRichTextContent (index)
 Get text string of a rich text string specified by index.
More...
 
def GetRichTextCount ()
 Get the count of rich text strings.
More...
 
def GetRichTextStyle (index)
 Get style data of a rich text string specified by index.
More...
 
def GetStateAnnots (model)
 Get all state annotations in a specified state model.
More...
 
def GetSubject ()
 Get subject string.
More...
 
def GetTitle ()
 Get title string.
More...
 
def InsertRichText (index, content, style)
 Insert a new rich text string to the place which is specified by index.
More...
 
def IsGrouped ()
 Check whether current markup annotation is in a group or not.
More...
 
def RemoveAllReplies ()
 Remove all the replies.
More...
 
def RemoveAllStateAnnots ()
 Remove all the state annotations.
More...
 
def RemovePopup ()
 Remove related pop-up annotation.
More...
 
def RemoveReply (index)
 Remove a reply by index.
More...
 
def RemoveRichText (index)
 Remove a rich text string specified by index.
More...
 
def SetBorderOpacity (opacity)
 Set the border opacity of the annotation.
More...
 
def SetCreationDateTime (date_time)
 Set creation date time.
More...
 
def SetFillOpacity (opacity)
 Set the fill opacity of the annotation.
More...
 
def SetIntent (intent)
 Set intent name.
More...
 
def SetOpacity (opacity)
 Set opacity value.
More...
 
def SetPopup (popup)
 Set related pop-up annotation.
More...
 
def SetRichTextContent (index, content)
 Set text string of a rich text string specified by index.
More...
 
def SetRichTextStyle (index, style)
 Set style data of a rich text string specified by index.
More...
 
def SetSubject (subject)
 Set subject string.
More...
 
def SetTitle (title)
 Set title string.
More...
 
def Ungroup ()
 Ungroup current markup annotation from the group it belongs to.
More...
 

Detailed Description

Markup annotations are used primarily to mark up PDF documents. These annotations have text that appears as part of the annotation and may be displayed in other ways by a viewer application, such as in a Comments pane.
Class fsdk.Markup is derived from class Annot , and is also the base class for all PDF markup annotations. It offers the base functions to get/set markup annotation's common properties. For concrete markup annotation types, please refer to derived classes.
Function fsdk.Annot.IsMarkup can be used to judge if an annotation is a markup annotation.

Note
Currently, following kinds of functions only support note, highlight, underline, strikeout, squiggly, square, circle, free text, stamp, caret, ink, line, polygon, polyline, file attachment annotations:
See also
Annot

Member Function Documentation

◆ AddReply()

def fsdk.Markup.AddReply ( )

Add a new reply to the end of reply list.

Returns
A new note annotation that represents the new reply annotation.

◆ AddRichText()

def fsdk.Markup.AddRichText (   content,
  style 
)

Add a new rich text string to the end.

Markup annotation's content can consist of several rich text strings. Specially, if current annotation is a freetext and its intent is "FreeTextTypewriter", text aligment of input style will be set to all rich text strings of current freetext annotation.

Parameters
[in]contentText string used as content of the new rich text string. This should not be an empty string.
[in]styleStyle data used for the new rich text string.
Returns
None.

◆ AddStateAnnot()

def fsdk.Markup.AddStateAnnot (   title,
  model,
  state 
)

Add a new state annotation.

A markup annotation may have one or several author-specific state associated with it. Each state is not specified in the annotation itself but in a separate note annotation.

  • For state model fsdk.MarkupE_StateModelReview , this function will add a new state annotation once this function is called.
  • For state model fsdk.MarkupE_StateModelMarked , this function will find the latest state annotation with this model and the same title as input parameter title: if find one, this function will change state value of the found state annotation and return the found state annotation directly; if not find any suitable state annotation, this function will add a new one and return the new state annotation.


Parameters
[in]titleTitle for the new state annotation. Title can be used to identify the user who added current annotation. This can be an empty string but users are strongly recommended to set a meaningful title when using this function.
[in]modelState model for the new state annotation. It should be one of following values:
[in]stateState value for the new state annotation. It should be one of following values:
Returns
A note annotation which represents the new state annotation. Last modified date time of the returned state annotation would be set with current local system time by default.

◆ GetBorderOpacity()

def fsdk.Markup.GetBorderOpacity ( )

Get the border opacity of the annotation.

Returns
The opacity value. Valid range: 0.0 to 1.0. 0.0 means full transparency and 1.0 means full opaque.

◆ GetCreationDateTime()

def fsdk.Markup.GetCreationDateTime ( )

Get creation date time.

Returns
A date and time object that receives the creation date time. If there is no creation date time information, a date and time object with all 0 values would be returned.

◆ GetFillOpacity()

def fsdk.Markup.GetFillOpacity ( )

Get the fill opacity of the annotation.

Returns
The opacity value. Valid range: 0.0 to 1.0. 0.0 means full transparency and 1.0 means full opaque.

◆ GetGroupElements()

def fsdk.Markup.GetGroupElements ( )

Get an element (as markup annotation) from the group that current markup annotation belongs to.

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

Returns
An array that contains all the markup annotations in the group. If current annotation does not belong to a group, this function will return an empty array.

◆ GetGroupHeader()

def fsdk.Markup.GetGroupHeader ( )

Get the header annotation (as primary annotation) of the group that current markup annotation belongs to.

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

Returns
The header markup annotation of the group that current markup annotation belongs to. If the return value of function fsdk.Annot.IsEmpty (inherited from Markup's parent class) for the returned markup annotation object is true, that means current annotation does not belong to a group.

◆ GetIntent()

def fsdk.Markup.GetIntent ( )

Get intent name.

Following annotation types have predefined intent name:

  • Free text annotation's predefined intent name: "FreeTextCallout", "FreeTextTypewriter". If no intent name is used, free text annotation would be shown as a text box.
  • Line annotation's predefined intent name: "LineArrow", "LineDimension". If no intent name is used, line annotation would be shown as a common line.
  • Polygon's predefined intent name: "PolygonCloud", "PolygonDimension". If no intent name is used, polygon annotation would be shown as a common polygon.
  • Polyline annotation's predefined intent name: "PolyLineDimension". If no intent name is used, polyline annotation would be shown as a common polyline.


Returns
The intent name string.

◆ GetOpacity()

def fsdk.Markup.GetOpacity ( )

Get opacity value.

This property has effect on markup annotation's appearance.

Returns
The opacity value. Valid range: 0.0 to 1.0. 0.0 means full transparency and 1.0 means full opaque.

◆ GetPopup()

def fsdk.Markup.GetPopup ( )

Get related pop-up annotation.

Most markup annotations can have a pop-up annotation to show their content, except sound and free text annotations:

  • For sound annotation, it does not have a pop-up annotation.
  • For free text annotation, it shows text directly on the page, so no need to have a pop-up annotation.

Though, in some special(or error) PDF document, sound or free text annotation may have a pop-up annotation, they still do not need a pop-up annotation.

Returns
The related pop-up annotation. If the return value of function fsdk.Annot.IsEmpty (inherited from Popup 's parent class) for the returned pop-up annotation is true, that means current markup annotation does not have a pop-up annotation.

◆ GetReply()

def fsdk.Markup.GetReply (   index)

Get a reply by index.

Parameters
[in]indexThe index for a specified reply. Valid range: from 0 to (count-1). count is returned by function fsdk.Markup.GetReplyCount .
Returns
A note annotation that represents the specified reply annotation.

◆ GetReplyCount()

def fsdk.Markup.GetReplyCount ( )

Count all replies.

Returns
The count of replies.

◆ GetRichTextContent()

def fsdk.Markup.GetRichTextContent (   index)

Get text string of a rich text string specified by index.

Markup annotation's content can consist of several rich text strings.

Parameters
[in]indexIndex for a rich text string whose content is to be retrieved. Valid range: from 0 to (count-1). count is returned by function fsdk.Markup.GetRichTextCount .
Returns
Text string for the specified rich text.

◆ GetRichTextCount()

def fsdk.Markup.GetRichTextCount ( )

Get the count of rich text strings.

Markup annotation's content can consist of several rich text strings.

Returns
Count of rich text strings.

◆ GetRichTextStyle()

def fsdk.Markup.GetRichTextStyle (   index)

Get style data of a rich text string specified by index.

Markup annotation's content can consist of several rich text strings.

Parameters
[in]indexIndex for a rich text string whose style data is to be retrieved. Valid range: from 0 to (count-1). count is returned by function fsdk.Markup.GetRichTextCount .
Returns
Style data for the specified rich text string.

◆ GetStateAnnots()

def fsdk.Markup.GetStateAnnots (   model)

Get all state annotations in a specified state model.

A markup annotation may have one or several author-specific state associated with it. Each state is not specified in the annotation itself but in a separate note annotation.

Parameters
[in]modelState model. It should be one of following values:
Returns
A note annotation array which represents all state annotations in the specified state model. All the annotations in this array would be in a chronological order.

◆ GetSubject()

def fsdk.Markup.GetSubject ( )

Get subject string.

Returns
Subject string.

◆ GetTitle()

def fsdk.Markup.GetTitle ( )

Get title string.

By convention, annotation's title can be used to identify the user who added current annotation.

Returns
Title string.

◆ InsertRichText()

def fsdk.Markup.InsertRichText (   index,
  content,
  style 
)

Insert a new rich text string to the place which is specified by index.

Markup annotation's content can consist of several rich text strings. Specially, if current annotation is a freetext and its intent is "FreeTextTypewriter", text aligment of input style will be set to all rich text strings of current freetext annotation.

Parameters
[in]indexIndex for a rich text string whose style data is to be inserted at. Valid range: from 0 to count. count is returned by function fsdk.Markup.GetRichTextCount .
If input value is equal to rich text string count, that means to add the new rich text string to the end. In this case, this funcion equals to function fsdk.Markup.AddRichText .
[in]contentText string used as content of the new rich text string. This should not be an empty string.
[in]styleStyle data used for the new rich text string.
Returns
None.

◆ IsGrouped()

def fsdk.Markup.IsGrouped ( )

Check whether current markup annotation is in a group or not.

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

Returns
true means current markup annotation is in a group. false means current markup annotation does not belong to any group.

◆ RemoveAllReplies()

def fsdk.Markup.RemoveAllReplies ( )

Remove all the replies.

Returns
true means success, while false means failure.

◆ RemoveAllStateAnnots()

def fsdk.Markup.RemoveAllStateAnnots ( )

Remove all the state annotations.

State annotation is represented by note annotation, so, to remove state annotations means to remove this kind of note annotations (with their popup annotations if any) from the page.

Returns
true means remove all the state annotations successfully or current annotation does not have any state annotation, while false means failure.

◆ RemovePopup()

def fsdk.Markup.RemovePopup ( )

Remove related pop-up annotation.

Returns
true means that related pop-up annotation is removed successfully, while false means current markup annotation does not have a related pop-up annotation.

◆ RemoveReply()

def fsdk.Markup.RemoveReply (   index)

Remove a reply by index.

If specified reply has its own replies, these sub replies will be removed at the same time.

Parameters
[in]indexThe index for a specified reply to be removed. Valid range: from 0 to (count-1). count is returned by function fsdk.Markup.GetReplyCount .
Returns
true means success, while false means failure.

◆ RemoveRichText()

def fsdk.Markup.RemoveRichText (   index)

Remove a rich text string specified by index.

Markup annotation's content can consist of several rich text strings.

Parameters
[in]indexIndex for a rich text string whose style data is to be inserted at. Valid range: from 0 to (count-1). count is returned by function fsdk.Markup.GetRichTextCount .

Returns
None.

◆ SetBorderOpacity()

def fsdk.Markup.SetBorderOpacity (   opacity)

Set the border opacity of the annotation.

This property has effect on markup annotation's appearance. If user wants the new opacity value has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting the new opacity value.

Parameters
[in]opacityThe new opacity value. Valid range: 0.0 to 1.0 . 0.0 means full transparency and 1.0 means full opaque.
Returns
None.

◆ SetCreationDateTime()

def fsdk.Markup.SetCreationDateTime (   date_time)

Set creation date time.

Parameters
[in]date_timeThe new date time to be set.
Returns
None.

◆ SetFillOpacity()

def fsdk.Markup.SetFillOpacity (   opacity)

Set the fill opacity of the annotation.

This property has effect on markup annotation's appearance. If user wants the new opacity value has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting the new opacity value.

Parameters
[in]opacityThe new opacity value. Valid range: 0.0 to 1.0 . 0.0 means full transparency and 1.0 means full opaque.
Returns
None.

◆ SetIntent()

def fsdk.Markup.SetIntent (   intent)

Set intent name.

Following annotation types have predefined intent name:

  • Free text annotation's predefined intent name: "FreeTextCallout", "FreeTextTypewriter". If no intent name is used, free text annotation would be shown as a text box. If the intent name is FreeTextTypewriter, the border color will be removed.
  • Line annotation's predefined intent name: "LineArrow", "LineDimension". If no intent name is used, line annotation would be shown as a common line.
    If a line annotation's intent is to be set to "LineArrow", the line annotation's line ending styles will be fsdk.MarkupE_EndingStyleNone for start point and fsdk.MarkupE_EndingStyleOpenArrow for end point by default.
  • Polygon's predefined intent name: "PolygonCloud", "PolygonDimension". If no intent name is used, polygon annotation would be shown as a common polygon.
    If a polygon annotation's intent is to be set to "PolygonCloud", the polygon annotation's border style will be changed to fsdk.BorderInfoE_Cloudy and border cloud intensity will be set to 2 by default.
  • Polyline annotation's predefined intent name: "PolyLineDimension". If no intent name is used, polyline annotation would be shown as a common polyline.

If supported predefined intent name has been set to corresponding type of annotation, user should call function fsdk.Annot.ResetAppearanceStream to make the effect on annotation's appearance.

Parameters
[in]intentNew intent name string to be set. If it is an empty string, that means the intent property will not be used.
Some annotation type have predefined intent name, please refer to "Details" part for more details. If this string is one of those unsupported intent name, this string will be ignored when set to corresponding annotations.
Returns
None.

◆ SetOpacity()

def fsdk.Markup.SetOpacity (   opacity)

Set opacity value.

This property has effect on markup annotation's appearance. If user wants the new opacity value has effect on annotation's appearance, please call function fsdk.Annot.ResetAppearanceStream after setting the new opacity value.

Parameters
[in]opacityThe new opacity value. Valid range: 0.0 to 1.0 . 0.0 means full transparency and 1.0 means full opaque.
Returns
None.

◆ SetPopup()

def fsdk.Markup.SetPopup (   popup)

Set related pop-up annotation.

Most markup annotations can have a pop-up annotation to show their content, except sound and free text annotations:

  • For sound annotation, it does not have a pop-up annotation.
  • For free text annotation, it shows text directly on the page, so no need to have a pop-up annotation.

So, this function does not allow to set pop-up annotation to sound and free text annotation.

Parameters
[in]popupA valid pop-up annotation to be set to current markup annotation.
Returns
None.

◆ SetRichTextContent()

def fsdk.Markup.SetRichTextContent (   index,
  content 
)

Set text string of a rich text string specified by index.

Markup annotation's content can consist of several rich text strings.

Parameters
[in]indexIndex for a rich text string whose content is to be set. Valid range: from 0 to (count-1). count is returned by function fsdk.Markup.GetRichTextCount .
[in]contentText string to be set as content for specified rich text. This should not be an empty string.
Returns
None.

◆ SetRichTextStyle()

def fsdk.Markup.SetRichTextStyle (   index,
  style 
)

Set style data of a rich text string specified by index.

Markup annotation's content can consist of several rich text strings.
Specially, if current annotation is a freetext and its intent is "FreeTextTypewriter", text aligment of input style will be set to all rich text strings of current freetext annotation.

Parameters
[in]indexIndex for a rich text string whose style data is to be retrieved. Valid range: from 0 to (count-1). count is returned by function fsdk.Markup.GetRichTextCount .
[in]styleStyle data used to be set to specified rich text.
Returns
None.

◆ SetSubject()

def fsdk.Markup.SetSubject (   subject)

Set subject string.

Parameters
[in]subjectNew subject string to be set.
Returns
None.

◆ SetTitle()

def fsdk.Markup.SetTitle (   title)

Set title string.

By convention, annotation's title can be used to identify the user who added current annotation.

Parameters
[in]titleNew title string to be set.
Returns
None.

◆ Ungroup()

def fsdk.Markup.Ungroup ( )

Ungroup current markup annotation from the group it belongs to.

  • If current markup annotation is just the group header, this function will disband the whole group.
  • If current markup annotation is just a member of a group, this function will only ungroup current markup annotation from the group it belongs to.
  • If current markup annotation does not belong to any group, this function will do nothing and return false directly.


Returns
true means success, while false means current markup annotation does not belong to any group.