Class: WidgetAnnot

PDFNet. WidgetAnnot


new WidgetAnnot()

Interactive forms use widget annotations (PDF 1.2) to represent the appearance of fields and to manage user interactions. As a convenience, when a field has only a single associated widget annotation, the contents of the field dictionary and the annotation dictionary may be merged into a single dictionary containing entries that pertain to both a field and an annotation. NOTE This presents no ambiguity, since the contents of the two kinds of dictionaries do not conflict.

Extends

  • Annot

Members


<static> HighlightingMode

Properties:
Name Type Description
e_none number
e_invert number
e_outline number
e_push number
e_toggle number

<static> IconCaptionRelation

Properties:
Name Type Description
e_NoIcon number
e_NoCaption number
e_CBelowI number
e_CAboveI number
e_CRightILeft number
e_CLeftIRight number
e_COverlayI number

<static> ScaleCondition

Properties:
Name Type Description
e_Always number
e_WhenBigger number
e_WhenSmaller number
e_Never number

<static> ScaleType

Properties:
Name Type Description
e_Anamorphic number
e_Proportional number

Methods


<static> create(doc, pos, field)

Creates a new widget annotation in the specified document.
Parameters:
Name Type Description
doc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc A document to which the annotation is added.
pos PDFNet.Rect A rectangle specifying the annotation's bounds in default user space units.
field PDFNet.Field A form field associated with this widget.
Returns:
A promise that resolves to a newly created blank widget annotation.
Type
Promise.<PDFNet.WidgetAnnot>

<static> createFromAnnot(ann)

creates a widget annotation and initializes it using given annotation object.
Parameters:
Name Type Description
ann PDFNet.Annot Annot object used to initialize the Widget annotation.
Returns:
A promise that resolves to an object of type: "PDFNet.WidgetAnnot"
Type
Promise.<PDFNet.WidgetAnnot>

<static> createFromObj( [d])

creates a widget annotation and initializes it using given Cos/SDF object.
Parameters:
Name Type Argument Description
d PDFNet.Obj <optional>
The Cos/SDF object to initialze the annotation with.
Returns:
A promise that resolves to an object of type: "PDFNet.WidgetAnnot"
Type
Promise.<PDFNet.WidgetAnnot>

getAction()

Returns the action of the widget annotation
Returns:
A promise that resolves to an action object representing the action of the widget annotation that should be performed when the annotation is activated.
Type
Promise.<PDFNet.Action>

getBackgroundColor()

Returns the background color of the annotation.
Returns:
A promise that resolves to a color object that denotes the color of the Screen background.
Type
Promise.<PDFNet.ColorPt>

getBackgroundColorCompNum()

Returns the number indicating background color space of the annotation.
Returns:
A promise that resolves to an integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk" if color space is applicable, 0 means no background color was assigned.
Type
Promise.<number>

getBorderColor()

Returns the border color of the annotation.
Returns:
A promise that resolves to a color object that denotes the color of the Screen border.
Type
Promise.<PDFNet.ColorPt>

getBorderColorCompNum()

Returns the number indicating border color space of the annotation.
Returns:
A promise that resolves to an integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk". 0 means this annotation had no color assigned.
Type
Promise.<number>

getField()

Returns the field associated with the Widget.
Returns:
A promise that resolves to a Field object.
Type
Promise.<PDFNet.Field>

getFitFull()

Returns the "fit full" flag.
Returns:
A promise that resolves to a boolean value indicating the "fit full" flag value.
Type
Promise.<boolean>

getFont()

Retrieves the font used for displaying text in this Widget.
Returns:
A promise that resolves to the font used by this Widget.
Type
Promise.<PDFNet.Font>

getFontSize()

Returns the font size used in this Widget Annotation.
Returns:
A promise that resolves to the font size
Type
Promise.<number>

getHIconLeftOver()

Returns the horizontal leftover space of the icon within the annotation.
Returns:
A promise that resolves to a number indicating the horizontal leftover space of the icon within the annotation.
Type
Promise.<number>

getHighlightingMode()

Default Value:
  • e_invert.
Returns:
A promise that resolves to the HighlightingMode of the widget annotation.
Type
Promise.<number>
Example
Return value enum:
<pre>
PDFNet.WidgetAnnot.HighlightingMode = {
	e_none : 0
	e_invert : 1
	e_outline : 2
	e_push : 3
	e_toggle : 4
}
</pre>

getIconCaptionRelation()

Returns the Icon and caption relationship of the annotation.
See:
  • IconCaptionRelation
Returns:
A promise that resolves to a value of the "IconCaptionRelation" enum type. Default value: e_NoIcon.
Type
Promise.<number>
Example
Return value enum:
<pre>
PDFNet.WidgetAnnot.IconCaptionRelation = {
	e_NoIcon : 0
	e_NoCaption : 1
	e_CBelowI : 2
	e_CAboveI : 3
	e_CRightILeft : 4
	e_CLeftIRight : 5
	e_COverlayI : 6
}
</pre>

getMouseDownCaptionText()

Returns the button down caption text of the annotation.
Returns:
A promise that resolves to a string containing the button down text of the annotation.
Type
Promise.<string>

getMouseDownIcon()

Returns the Mouse Down icon associated with the annotation.
Returns:
A promise that resolves to an SDF object that represents the Mouse Down icon associated with the annotation.
Type
Promise.<PDFNet.Obj>

getRolloverCaptionText()

Returns the rollover caption text of the annotation.
Returns:
A promise that resolves to a string containing the rollover caption text of the annotation.
Type
Promise.<string>

getRolloverIcon()

Returns the rollover icon associated with the annotation.
Returns:
A promise that resolves to an SDF object that represents the rollover icon associated with the annotation.
Type
Promise.<PDFNet.Obj>

getScaleCondition()

Returns the condition under which the icon should be scaled.
See:
  • ScaleCondition
Returns:
A promise that resolves to a value of the "ScaleCondition" enum type. Default value: e_Always.
Type
Promise.<number>
Example
Return value enum:
<pre>
PDFNet.WidgetAnnot.ScaleCondition = {
	e_Always : 0
	e_WhenBigger : 1
	e_WhenSmaller : 2
	e_Never : 3
}
</pre>

getScaleType()

Returns the Scale Type of the annotation.
See:
  • ScaleType
Returns:
A promise that resolves to a value of the "ScaleType" enum which represents the Scale Type of the annotation. Default value: P.
Type
Promise.<number>
Example
Return value enum:
<pre>
PDFNet.WidgetAnnot.ScaleType = {
	e_Anamorphic : 0
	e_Proportional : 1
}
</pre>

getStaticCaptionText()

Returns static caption text of the annotation.
Returns:
A promise that resolves to a string containing the static caption text of the annotation.
Type
Promise.<string>

getStaticIcon()

Returns the static icon associated with the annotation.
Returns:
A promise that resolves to an SDF object that represents the static icon associated with the annotation.
Type
Promise.<PDFNet.Obj>

getTextColor(col, col_comp)

Parameters:
Name Type Description
col PDFNet.ColorPt
col_comp number
Returns:
Type
Promise.<void>

getVIconLeftOver()

Returns the vertical leftover space of the icon within the annotation.
Returns:
A promise that resolves to a number indicating the vertical leftover space of the icon within the annotation.
Type
Promise.<number>

setAction(action)

Sets the action of the widget annotation (Optional; PDF 1.2 )
Parameters:
Name Type Description
action PDFNet.Action An action object representing the action of the widget annotation that should be performed when the annotation is activated.
Returns:
Type
Promise.<void>

setBackgroundColor(col, compnum)

sets the background color of the annotation. (Optional)
Parameters:
Name Type Description
col PDFNet.ColorPt A color point that denotes the color of the screen background.
compnum number An integer which value indicates the color space used for the parameter c.
Returns:
Type
Promise.<void>

setBorderColor(col, compnum)

sets the border color of the annotation. (Optional)
Parameters:
Name Type Description
col PDFNet.ColorPt A color object that denotes the color of the screen border.
compnum number An integer which value indicates the color space used for the parameter c.
Returns:
Type
Promise.<void>

setFitFull(ff)

sets the "fit full" flag. (Optional)
Parameters:
Name Type Description
ff boolean A boolean value indicating the "fit full" flag value.
Returns:
Type
Promise.<void>

setFont(font)

Specifies a font to be used for text in this Widget.
Parameters:
Name Type Description
font PDFNet.Font the font to use.
Returns:
Type
Promise.<void>

setFontSize(font_size)

Sets the font size of the Widget Annotation.
Parameters:
Name Type Description
font_size number the new font size
Returns:
Type
Promise.<void>

setHIconLeftOver(hl)

sets the horizontal leftover space of the icon within the annotation. (Optional)
Parameters:
Name Type Description
hl number A number indicating the horizontal leftover space of the icon within the annotation.
Returns:
Type
Promise.<void>

setHighlightingMode( [value])

sets the HighlightingMode for the widget annotation.
Parameters:
Name Type Argument Description
value number <optional>
PDFNet.WidgetAnnot.HighlightingMode = {
	e_none : 0
	e_invert : 1
	e_outline : 2
	e_push : 3
	e_toggle : 4
}
New highlighting mode for the widget.
Returns:
Type
Promise.<void>

setIconCaptionRelation(icr)

sets the Icon and caption relationship of the annotation. (Optional; pushbutton fields only)
Parameters:
Name Type Description
icr number
PDFNet.WidgetAnnot.IconCaptionRelation = {
	e_NoIcon : 0
	e_NoCaption : 1
	e_CBelowI : 2
	e_CAboveI : 3
	e_CRightILeft : 4
	e_CLeftIRight : 5
	e_COverlayI : 6
}
A value of the "IconCaptionRelation" enum type. Default value: e_NoIcon.
See:
  • IconCaptionRelation
Returns:
Type
Promise.<void>

setMouseDownCaptionText(contents)

sets the button down caption text of the annotation. (Optional; button fields only)
Parameters:
Name Type Description
contents string A string containing the button down text of the annotation.
Returns:
Type
Promise.<void>

setMouseDownIcon(icon)

sets the Mouse Down icon associated with the annotation. (Optional; button fields only)
Parameters:
Name Type Description
icon PDFNet.Obj An SDF object that represents the Mouse Down icon associated with the annotation.
Returns:
Type
Promise.<void>

setRolloverCaptionText(contents)

sets the roll over caption text of the annotation. (Optional; button fields only)
Parameters:
Name Type Description
contents string A string containing the roll over caption text of the annotation.
Returns:
Type
Promise.<void>

setRolloverIcon(icon)

sets the rollover icon associated with the annotation. (Optional; button fields only)
Parameters:
Name Type Description
icon PDFNet.Obj An SDF object that represents the rollover icon associated with the annotation.
Returns:
Type
Promise.<void>

setScaleCondition(sd)

sets the condition under which the icon should be scaled. (Optional)
Parameters:
Name Type Description
sd number
PDFNet.WidgetAnnot.ScaleCondition = {
	e_Always : 0
	e_WhenBigger : 1
	e_WhenSmaller : 2
	e_Never : 3
}
A value of the "ScaleCondition" enum type. Default value: e_Always.
Returns:
Type
Promise.<void>

setScaleType(st)

sets the Scale Type of the annotation. (Optional)
Parameters:
Name Type Description
st number
PDFNet.WidgetAnnot.ScaleType = {
	e_Anamorphic : 0
	e_Proportional : 1
}
An entry of the "ScaleType" enum which represents the Scale Type of the annotation. Default value: P.
See:
  • ScaleType
Returns:
Type
Promise.<void>

setStaticCaptionText(contents)

sets static caption text of the annotation. (Optional; button fields only)
Parameters:
Name Type Description
contents string A string containing the static caption text of the annotation.
Returns:
Type
Promise.<void>

setStaticIcon(icon)

sets the static icon associated with the annotation. (Optional; button fields only)
Parameters:
Name Type Description
icon PDFNet.Obj An SDF object that represents the static icon associated with the annotation.
Returns:
Type
Promise.<void>

setTextColor(col, col_comp)

Parameters:
Name Type Description
col PDFNet.ColorPt
col_comp number
Returns:
Type
Promise.<void>

setVIconLeftOver(vl)

sets the vertical leftover space of the icon within the annotation. (Optional)
Parameters:
Name Type Description
vl number A number indicating the vertical leftover space of the icon within the annotation.
Returns:
Type
Promise.<void>