Foxit PDF SDK
fsdk.Widget Class Reference

Public Member Functions

def GetAction ()
 Get action. More...
 
def GetAppearanceOnStateName ()
 Get the name of the annotation's appearance "ON" state. More...
 
def GetAppearanceState ()
 Get the annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary. More...
 
def GetControl ()
 Get associated form control. More...
 
def GetField ()
 Get associated form field. More...
 
def GetHighlightingMode ()
 Get highlighting mode. More...
 
def GetMKBackgroundColor ()
 Get the background color in the MK dictionary. More...
 
def GetMKBorderColor ()
 Get the border color in the MK dictionary. More...
 
def GetMKDownCaption ()
 Get the down caption string in the MK dictionary. More...
 
def GetMKDownIconBitmap ()
 Get the down icon bitmap in the MK dictionary. More...
 
def GetMKIconCaptionRelation ()
 Get the relation of icon and caption in the MK dictionary. More...
 
def GetMKIconFit ()
 Get the icon fit information in the MK dictionary. More...
 
def GetMKNormalCaption ()
 Get the normal caption string in the MK dictionary. More...
 
def GetMKNormalIconBitmap ()
 Get the normal icon bitmap in the MK dictionary. More...
 
def GetMKRolloverCaption ()
 Get the rollover caption string in the MK dictionary. More...
 
def GetMKRolloverIconBitmap ()
 Get the rollover icon bitmap in the MK dictionary. More...
 
def GetMKRotation ()
 Get the rotation value in the MK dictionary. More...
 
def HasMKEntry (mk_entry)
 Check if a specified entry exists in the MK dictionary. More...
 
def RemoveAction ()
 Remove action. More...
 
def RemoveMKEntry (mk_entry)
 Remove a specified entry from the MK dictionary. More...
 
def SetAction (action)
 Set action. More...
 
def SetAppearanceState (appearance_state)
 Set the annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary. More...
 
def SetHighlightingMode (mode)
 Set highlighting mode. More...
 
def SetLineSpacing (line_spacing_style, line_spacing_value)
 Set line spacing for current widget. More...
 
def SetMKBackgroundColor (color)
 Set the background color in the MK dictionary. More...
 
def SetMKBorderColor (color)
 Set the border color in the MK dictionary. More...
 
def SetMKDownCaption (caption)
 Set the down caption string in the MK dictionary. More...
 
def SetMKDownIconBitmap (bitmap)
 Set the down icon bitmap in the MK dictionary. More...
 
def SetMKDownIconImage (image, frame_index)
 Set an image with specified frame index as down icon in the MK dictionary. More...
 
def SetMKIconCaptionRelation (relation)
 Set the relation of icon and caption in the MK dictionary. More...
 
def SetMKIconFit (icon_fit)
 Set the icon fit information in the MK dictionary. More...
 
def SetMKNormalCaption (caption)
 Set the normal caption string in the MK dictionary. More...
 
def SetMKNormalIconBitmap (bitmap)
 Set a bitmap as normal icon in the MK dictionary. More...
 
def SetMKNormalIconImage (image, frame_index)
 Set an image with specified frame index as normal icon in the MK dictionary. More...
 
def SetMKRolloverCaption (caption)
 Set the rollover caption string in the MK dictionary. More...
 
def SetMKRolloverIconBitmap (bitmap)
 Set the rollover icon bitmap in the MK dictionary. More...
 
def SetMKRolloverIconImage (image, frame_index)
 Set an image with specified frame index as rollover icon in the MK dictionary. More...
 
def SetMKRotation (rotation)
 Set the rotation value in the MK dictionary. More...
 

Detailed Description

A widget annotation is used to represent the appearance of form fields.
Class fsdk.Widget is derived from class Annot and also offers functions to get/set widget annotation's properties. Functions fsdk.Widget.GetField and fsdk.Widget.GetControl can be used to get the associated form field and form control object. If a widget annotation is not associated with any form field or is associated with a signature field, this widget can still get/set properties, but cannot be reset appearance. For these cases, fsdk.Annot.ResetAppearanceStream (inherited from Widget's parent class) will return false directly.

See also
Annot
fsdk.Field
fsdk.Control

Member Function Documentation

◆ GetAction()

def fsdk.Widget.GetAction ( )

Get action.

This function cannot be used to get action which is used as additional action. If user wants to get any additional action, please refer to class fsdk.AdditionalAction for more details.

Returns
An action object that receives the action data. If the return value of function fsdk.Action.IsEmpty for the returned action object is true, that means no action.

◆ GetAppearanceOnStateName()

def fsdk.Widget.GetAppearanceOnStateName ( )

Get the name of the annotation's appearance "ON" state.

Returns
The name of the annotation's appearance "ON" state.

◆ GetAppearanceState()

def fsdk.Widget.GetAppearanceState ( )

Get the annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary.

Returns
The annotation's appearance state.

◆ GetControl()

def fsdk.Widget.GetControl ( )

Get associated form control.

Returns
The associated form control object.

◆ GetField()

def fsdk.Widget.GetField ( )

Get associated form field.

Returns
The associated form field object.

◆ GetHighlightingMode()

def fsdk.Widget.GetHighlightingMode ( )

Get highlighting mode.

Highlighting mode is the visual effect to be used when the mouse button is pressed or held down inside its active area.

Returns
Highlighting mode value. Please refer to values starting from fsdk.AnnotE_HighlightingNone and this would be one of these values.

◆ GetMKBackgroundColor()

def fsdk.Widget.GetMKBackgroundColor ( )

Get the background color in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.

Returns
The background color in MK dictionary. Value format: 0xRRGGBB.
0 may means no background color in MK dictionary. In this case, please call function fsdk.Widget.HasMKEntry with value fsdk.AnnotE_MKEntryBackgroundColor to check.

◆ GetMKBorderColor()

def fsdk.Widget.GetMKBorderColor ( )

Get the border color in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.

Returns
The border color in MK dictionary. Value format: 0xRRGGBB.
0 may means no border color in MK dictionary. In this case, please call function fsdk.Widget.HasMKEntry with value fsdk.AnnotE_MKEntryBorderColor to check.

◆ GetMKDownCaption()

def fsdk.Widget.GetMKDownCaption ( )

Get the down caption string in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Down caption (or alternate caption) in MK dictionary is used to displayed when the mouse button is pressed within its active area. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Returns
Down caption string. An empty string may means no down caption in MK dictionary. In this case, please call function fsdk.Widget.HasMKEntry with value fsdk.AnnotE_MKEntryDownCaption to check.

◆ GetMKDownIconBitmap()

def fsdk.Widget.GetMKDownIconBitmap ( )

Get the down icon bitmap in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Down icon (or alternate icon) in MK dictionary is used to displayed when the mouse button is pressed within its active area. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Returns
Down icon bitmap. If function fsdk.Bitmap.IsEmpty for the returned bitmap object returns true, that means current widget annotation does not have down icon bitmap.

◆ GetMKIconCaptionRelation()

def fsdk.Widget.GetMKIconCaptionRelation ( )

Get the relation of icon and caption in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. The relation position of caption and icon specifies where to position the text of the widget annotation's caption relative to its icon. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Returns
The relation position of caption and icon. Please refer to fsdk.AnnotE_MKRelationNoIcon values and it should be one of these values.

◆ GetMKIconFit()

def fsdk.Widget.GetMKIconFit ( )

Get the icon fit information in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. The icon fit information specifies how to display the widget annotation's icon within its annotation rectangle. If present, the icon fit information applies to all of the annotation's icons. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Returns
An icon fit object, which contains the icon fit information in MK dictionary. If scale way type of icon fit object is value fsdk.IconFitE_ScaleWayNone , that means no icon fit information in MK dictionary.

◆ GetMKNormalCaption()

def fsdk.Widget.GetMKNormalCaption ( )

Get the normal caption string in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Normal caption in MK dictionary is used to displayed when the widget is not interacting with the user. This is applicable for widget associated with pushbutton field, check box field or radio button field. For other type of fields, this will be useless.

Returns
Normal caption string. An empty string may means no normal caption in MK dictionary. In this case, please call function fsdk.Widget.HasMKEntry with value fsdk.AnnotE_MKEntryNormalCaption to check.

◆ GetMKNormalIconBitmap()

def fsdk.Widget.GetMKNormalIconBitmap ( )

Get the normal icon bitmap in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Normal icon in MK dictionary is used to displayed when the widget is not interacting with the user. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Returns
Normal icon bitmap. If function fsdk.Bitmap.IsEmpty for the returned bitmap object returns true, that means current widget annotation does not have normal icon bitmap.

◆ GetMKRolloverCaption()

def fsdk.Widget.GetMKRolloverCaption ( )

Get the rollover caption string in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Rollover caption in MK dictionary is used to displayed when the user rolls the cursor into its active area without pressing the mouse button. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Returns
Rollover caption string. An empty string may means no rollover caption in MK dictionary. In this case, please call function fsdk.Widget.HasMKEntry with value fsdk.AnnotE_MKEntryRolloverCaption to check.

◆ GetMKRolloverIconBitmap()

def fsdk.Widget.GetMKRolloverIconBitmap ( )

Get the rollover icon bitmap in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Rollover icon in MK dictionary is used to displayed when the user rolls the cursor into its active area without pressing the mouse button. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Returns
Rollover icon bitmap. If function fsdk.Bitmap.IsEmpty for the returned bitmap object returns true, that means current widget annotation does not have rollover icon bitmap.

◆ GetMKRotation()

def fsdk.Widget.GetMKRotation ( )

Get the rotation value in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. The rotation in MK dictionary specifies the degrees by which the widget annotation is rotated counterclockwise relative to the page.

Returns
The rotation value in MK dictionary. Please refer to values starting from fsdk.E_Rotation0 and this would be one of these values. Value fsdk.E_RotationUnknown means no rotation in MK dictionary. Specially, returned rotation value represents in counterclockwise.

◆ HasMKEntry()

def fsdk.Widget.HasMKEntry (   mk_entry)

Check if a specified entry exists in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.

Parameters
[in]mk_entryAn entry in MK dictionary. Please refer to values starting from fsdk.AnnotE_MKEntryRotation and this should be one of these values.
Returns
true means the specified entry exists in the MK dictionary, while false means not.

◆ RemoveAction()

def fsdk.Widget.RemoveAction ( )

Remove action.

This function cannot be used to remove action which is used as additional action. If user wants to remove any additional action, please refer to class fsdk.AdditionalAction for more details.

Returns
None.

◆ RemoveMKEntry()

def fsdk.Widget.RemoveMKEntry (   mk_entry)

Remove a specified entry from the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.

Parameters
[in]mk_entryAn entry in MK dictionary. Please refer to values starting from fsdk.AnnotE_MKEntryRotation and this should be one of these values.
Returns
None.

◆ SetAction()

def fsdk.Widget.SetAction (   action)

Set action.

This function cannot be used to set action which is used as additional action. If user wants to set any additional action, please refer to class fsdk.AdditionalAction for more details.

Parameters
[in]actionNew action to be set. It should be valid. Currently only support following types as the new action:
fsdk.ActionE_TypeGoto , fsdk.ActionE_TypeURI , fsdk.ActionE_TypeJavaScript , fsdk.ActionE_TypeNamed , fsdk.ActionE_TypeGoToR , fsdk.ActionE_TypeGoToE , fsdk.ActionE_TypeSubmitForm , fsdk.ActionE_TypeResetForm , fsdk.ActionE_TypeHide , fsdk.ActionE_TypeLaunch , fsdk.ActionE_TypeImportData , fsdk.ActionE_TypeRendition .
Returns
None.

◆ SetAppearanceState()

def fsdk.Widget.SetAppearanceState (   appearance_state)

Set the annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary.

Parameters
[in]appearance_stateThe annotation's appearance state.
Returns
None.

◆ SetHighlightingMode()

def fsdk.Widget.SetHighlightingMode (   mode)

Set highlighting mode.

Highlighting mode is the visual effect to be used when the mouse button is pressed or held down inside its active area.

Parameters
[in]modeNew highlighting mode value. Please refer to values starting from fsdk.AnnotE_HighlightingNone and this should be one of these values.
Returns
None.

◆ SetLineSpacing()

def fsdk.Widget.SetLineSpacing (   line_spacing_style,
  line_spacing_value 
)

Set line spacing for current widget.

This is only applicable for widget associated with text fields which contain the flag fsdk.FieldE_FlagTextMultiline . For other type of fields, this will be useless.

Parameters
[in]line_spacing_styleLine spacing style to be set to current widget.Please refer to values starting from fsdk.WidgetE_LineSpacingSingle and this would be one of these values.
[in]line_spacing_valueLine spacing exact value to be set to current widget when parameter line_spacing_style is fsdk.WidgetE_LineSpacingExactValue . When this parameter is useful, this parameter must be an non-negative value and the unit should be "pt" (known as point). If this value is zero, the effect of line spacing will be the same as single line spacing.
Returns
None.

◆ SetMKBackgroundColor()

def fsdk.Widget.SetMKBackgroundColor (   color)

Set the background color in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.

Parameters
[in]colorThe background color to be set in MK dictionary. Value format: 0xRRGGBB.
Returns
None.

◆ SetMKBorderColor()

def fsdk.Widget.SetMKBorderColor (   color)

Set the border color in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.

Parameters
[in]colorThe border color to be set in MK dictionary. Value format: 0xRRGGBB.
Returns
None.

◆ SetMKDownCaption()

def fsdk.Widget.SetMKDownCaption (   caption)

Set the down caption string in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Down caption (or alternate caption) in MK dictionary is used to displayed when the mouse button is pressed within its active area. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]captionDown caption string to be set in MK dictionary. It can be an empty string.
Returns
None.

◆ SetMKDownIconBitmap()

def fsdk.Widget.SetMKDownIconBitmap (   bitmap)

Set the down icon bitmap in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Down icon (or alternate icon) in MK dictionary is used to displayed when the mouse button is pressed within its active area. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]bitmapA valid bitmap to be set as down icon in MK dictionary.
Returns
None.

◆ SetMKDownIconImage()

def fsdk.Widget.SetMKDownIconImage (   image,
  frame_index 
)

Set an image with specified frame index as down icon in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Down icon (or alternate icon) in MK dictionary is used to displayed when the mouse button is pressed within its active area. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]imageAn image. One of its frames will be set as down icon in MK dictionary. This image should contain at least one frame and the image type should not be fsdk.ImageE_Unknown .
[in]frame_indexFrame index. Valid range: from 0 to (count-1). count is returned by function fsdk.Image.GetFrameCount .

◆ SetMKIconCaptionRelation()

def fsdk.Widget.SetMKIconCaptionRelation (   relation)

Set the relation of icon and caption in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. The relation position of caption and icon specifies where to position the text of the widget annotation's caption relative to its icon. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]relationThe relation position of caption and icon. Please refer to values starting from fsdk.AnnotE_MKRelationNoIcon and this should be one of these values.
Returns
None.

◆ SetMKIconFit()

def fsdk.Widget.SetMKIconFit (   icon_fit)

Set the icon fit information in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. The icon fit information specifies how to display the widget annotation's icon within its annotation rectangle. If present, the icon fit information applies to all of the annotation's icons. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]icon_fitAn icon fit object which represents the icon fit information to be set in MK dictionary. If value of any member in this object is invalid, this function will throw exception fsdk.E_ErrParam . Please refer to class IconFit to check the valid value range for each member.
Returns
None.

◆ SetMKNormalCaption()

def fsdk.Widget.SetMKNormalCaption (   caption)

Set the normal caption string in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Normal caption in MK dictionary is used to displayed when the widget is not interacting with the user. This is applicable for widgets associated with pushbutton field, check box field or radio button field. For other type of fields, this will be useless.

Parameters
[in]captionNormal caption string to be set in MK dictionary. It can be an empty string.
Returns
None.

◆ SetMKNormalIconBitmap()

def fsdk.Widget.SetMKNormalIconBitmap (   bitmap)

Set a bitmap as normal icon in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Normal icon in MK dictionary is used to displayed when the widget is not interacting with the user. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]bitmapA valid bitmap to be set as normal icon in MK dictionary.
Returns
None.

◆ SetMKNormalIconImage()

def fsdk.Widget.SetMKNormalIconImage (   image,
  frame_index 
)

Set an image with specified frame index as normal icon in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Normal icon in MK dictionary is used to displayed when the widget is not interacting with the user. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]imageAn image. One of its frames will be set as normal icon in MK dictionary. This image should contain at least one frame and the image type should not be fsdk.ImageE_Unknown .
[in]frame_indexFrame index. Valid range: from 0 to (count-1). count is returned by function fsdk.Image.GetFrameCount .

◆ SetMKRolloverCaption()

def fsdk.Widget.SetMKRolloverCaption (   caption)

Set the rollover caption string in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Rollover caption in MK dictionary is used to displayed when the user rolls the cursor into its active area without pressing the mouse button. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]captionRollover caption string to be set in MK dictionary. It can be an empty string.
Returns
None.

◆ SetMKRolloverIconBitmap()

def fsdk.Widget.SetMKRolloverIconBitmap (   bitmap)

Set the rollover icon bitmap in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Rollover icon in MK dictionary is used to displayed when the user rolls the cursor into its active area without pressing the mouse button. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]bitmapA valid bitmap to be set as rollover icon in MK dictionary.
Returns
None.

◆ SetMKRolloverIconImage()

def fsdk.Widget.SetMKRolloverIconImage (   image,
  frame_index 
)

Set an image with specified frame index as rollover icon in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. Rollover icon in MK dictionary is used to displayed when the user rolls the cursor into its active area without pressing the mouse button. This is applicable for widget associated with pushbutton field. For other type of fields, this will be useless.

Parameters
[in]imageAn image. One of its frames will be set as rollover icon in MK dictionary. This image should contain at least one frame and the image type should not be fsdk.ImageE_Unknown .
[in]frame_indexFrame index. Valid range: from 0 to (count-1). count is returned by function fsdk.Image.GetFrameCount .

◆ SetMKRotation()

def fsdk.Widget.SetMKRotation (   rotation)

Set the rotation value in the MK dictionary.

MK dictionary is an appearance characteristics dictionary to be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page. The rotation in MK dictionary specifies the degrees by which the widget annotation is rotated counterclockwise relative to the page.

Parameters
[in]rotationThe rotation value to be set in MK dictionary. Please refer to values starting from fsdk.E_Rotation0 and this should be one of these values except fsdk.E_RotationUnknown . Specially, rotation value here represents in counterclockwise.