Class: SignatureWidget

PDFNet. SignatureWidget


new SignatureWidget()

An object representing a Signature used in a PDF Form. These Widgets can be signed directly, or signed using a DigitalSignatureField.

Extends

Methods


<static> create(doc, pos [, field_name])

Creates a new SignatureWidget annotation in the specified document, and adds an associated signature form field to the document.
Parameters:
Name Type Argument Description
doc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc The document to which the widget is to be added.
pos PDFNet.Rect A rectangle specifying the widget's bounds in default user space units.
field_name string <optional>
The name of the digital signature field to create. Optional autogenerated by default.
Returns:
A promise that resolves to a newly-created blank SignatureWidget annotation.
Type
Promise.<PDFNet.SignatureWidget>

<static> createFromAnnot(annot)

Creates a Widget annotation and initializes it using given annotation object.
Parameters:
Name Type Description
annot PDFNet.Annot the annot Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.
Returns:
A promise that resolves to an object of type: "PDFNet.SignatureWidget"
Type
Promise.<PDFNet.SignatureWidget>

<static> createFromObj( [d])

Creates a SignatureWidget annotation and initializes it using given Cos/SDF object.
Parameters:
Name Type Argument Description
d PDFNet.Obj <optional>
the input Cos/SDF object Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.
Returns:
A promise that resolves to an object of type: "PDFNet.SignatureWidget"
Type
Promise.<PDFNet.SignatureWidget>

<static> createWithDigitalSignatureField(doc, pos, field)

Creates a new SignatureWidget annotation associated with a particular DigitalSignatureField object (representing a signature-type form field) in the specified document.
Parameters:
Name Type Description
doc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc The document to which the widget is to be added.
pos PDFNet.Rect A rectangle specifying the widget's bounds in default user space units.
field PDFNet.DigitalSignatureField The digital signature field for which to create a signature widget.
Returns:
A promise that resolves to a newly-created blank SignatureWidget annotation.
Type
Promise.<PDFNet.SignatureWidget>

<static> createWithField(doc, pos, field)

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

compare(d)

Compares two annotations for equality. The comparison will return true only if both annotations share the same underlying SDF/Cos object.
Parameters:
Name Type Description
d PDFNet.Annot Annotation to compare to
Inherited From:
Returns:
A promise that resolves to an object of type: "boolean"
Type
Promise.<boolean>

copy()

Copy Constructor
Inherited From:
Returns:
A promise that resolves to an object of type: "PDFNet.Annot"
Type
Promise.<PDFNet.Annot>

createSignatureAppearance(img)

A function that will create and add an appearance to this widget by centering an image within it.
Parameters:
Name Type Description
img PDFNet.Image A PDF::Image object representing the image to use.
Returns:
Type
Promise.<void>

deleteCustomData(key)

Deletes custom data associated with the given key.
Parameters:
Name Type Description
key string The key for which to delete the associated data.
Inherited From:
Returns:
Type
Promise.<void>

flatten(page)

Flatten/Merge the existing annotation appearances with the page content and delete this annotation from a given page. Annotation 'flattening' refers to the operation that changes active annotations (such as markup, widgets, 3D models, etc.) into a static area that is part of the PDF document, just like the other text and images in the document. Note: an alternative approach to set the annotation as read only is using Annot.SetFlag(Annot::e_read_only, true) method. Unlike Annot.SetFlag(...), the result of Flatten() operation can not be programatically reversed.
Parameters:
Name Type Description
page PDFNet.Page
Inherited From:
Returns:
Type
Promise.<void>

getAction()

Returns the action of the widget annotation
Inherited From:
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>

getActiveAppearanceState()

Gets the annotation's active appearance state.
Inherited From:
Returns:
A promise that resolves to the name of the active state. The annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary.
Type
Promise.<string>

getAppearance( [annot_state] [, app_state])

Gets the annotation's appearance for the given combination of annotation and appearance states.
Parameters:
Name Type Argument Description
annot_state number <optional>
PDFNet.Annot.State = {
	e_normal : 0
	e_rollover : 1
	e_down : 2
}
the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance.
app_state string <optional>
is an optional parameter specifying the appearance state to look for (e.g. "Off", "On", etc). If appearance_state is NULL, the choice between different appearance states is determined by the AS (Appearance State) entry in the annotation dictionary.
Inherited From:
Returns:
A promise that resolves to the appearance stream for this annotation, or NULL if the annotation does not have an appearance for the given combination of annotation and appearance states.
Type
Promise.<PDFNet.Obj>

getBackgroundColor()

Returns the background color of the annotation.
Inherited From:
Returns:
A promise that resolves to a color object that denotes the color of the Screen background. Note: The color can be in different color spaces: Gray, RGB, or CMYK. Call "GetBackgroundColorCompNum" to access the color space information corresponding to the border color.
Type
Promise.<PDFNet.ColorPt>

getBackgroundColorCompNum()

Returns the number indicating background color space of the annotation.
Inherited From:
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.
Inherited From:
Returns:
A promise that resolves to a color object that denotes the color of the Screen border. Note: The color can be in different color spaces: Gray, RGB, or CMYK. Call "GetBorderColorCompNum" to access the color space information corresponding to the border color.
Type
Promise.<PDFNet.ColorPt>

getBorderColorCompNum()

Returns the number indicating border color space of the annotation.
Inherited From:
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>

getBorderStyle()

Gets the border style for the annotation. Typically used for Link annotations.
Inherited From:
Returns:
A promise that resolves to annotation's border style.
Type
Promise.<PDFNet.AnnotBorderStyle>

getColor()

Gets an annotation's color without any specified color space. It is generally recommended to use getColorAsRGB(), getColorAsCMYK() or getColorAsGray() for more predictable behavior
Inherited From:
Returns:
A promise that resolves to a ColorPt object containing an array of numbers in the range 0.0 to 1.0.
Type
Promise.<PDFNet.ColorPt>

getColorAsCMYK()

Returns the annotation's color in CMYK color space.
Inherited From:
Returns:
A promise that resolves to a ColorPt object containing an array of four numbers in the range 0.0 to 1.0, representing a CMYK color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation If the annotation does not specify an explicit color, a default color is returned. Text annotations return 'default yellow;' all others return black.
Type
Promise.<PDFNet.ColorPt>

getColorAsGray()

Returns the annotation's color in Gray color space.
Inherited From:
Returns:
A promise that resolves to a ColorPt object containing a number in the range 0.0 to 1.0, representing a Gray Scale color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation If the annotation does not specify an explicit color, black color is returned.
Type
Promise.<PDFNet.ColorPt>

getColorAsRGB()

Gets an annotation's color in RGB color space.
Inherited From:
Returns:
A promise that resolves to a ColorPt object containing an array of three numbers in the range 0.0 to 1.0, representing an RGB colour used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation If the annotation does not specify an explicit color, a default color is returned. Text annotations return 'default yellow;' all others return black.
Type
Promise.<PDFNet.ColorPt>

getColorCompNum()

Returns the color space the annotation's color is represented in.
Inherited From:
Returns:
A promise that resolves to an integer that is either 1(for DeviceGray), 3(DeviceRGB), or 4(DeviceCMYK). If the annotation has no color, i.e. is transparent, 0 will be returned.
Type
Promise.<number>

getContents()

Extract the content of this annotation. (Optional).
Inherited From:
Returns:
A promise that resolves to A unicode string object with the text that is associated with this annotation. This is the text that annotation displays on user interaction, if the annotation type supports it.
Type
Promise.<string>

getCustomData(key)

Returns custom data associated with the given key.
Parameters:
Name Type Description
key string The key for which to retrieve the associated data.
Inherited From:
Returns:
A promise that resolves to the custom data string. If no data is available an empty string is returned.
Type
Promise.<string>

getDate()

Gets an annotation's last modified date.
Inherited From:
Returns:
A promise that resolves to the annotation's last modified time and date. If the annotation has no associated date structure, the returned date is not valid (date.IsValid() returns false). Corresponds to the "M" entry of the annotation dictionary.
Type
Promise.<PDFNet.Date>

getDigitalSignatureField()

Retrieves the DigitalSignatureField associated with this SignatureWidget.
Returns:
A promise that resolves to a DigitalSignatureField object representing the digital signature form field associated with this signature widget annotation.
Type
Promise.<PDFNet.DigitalSignatureField>

getField()

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

getFitFull()

Returns the "fit full" flag.
Inherited From:
Returns:
A promise that resolves to a boolean value indicating the "fit full" flag value. Note: the fit full flag, if true, indicates that the button appearance shall be scaled to fit fully within the bounds of the annotation without taking into consideration the line width of the border. Default value: false.
Type
Promise.<boolean>

getFlag(flag)

Parameters:
Name Type Description
flag number
PDFNet.Annot.Flag = {
	e_invisible : 0
	e_hidden : 1
	e_print : 2
	e_no_zoom : 3
	e_no_rotate : 4
	e_no_view : 5
	e_annot_read_only : 6
	e_locked : 7
	e_toggle_no_view : 8
	e_locked_contents : 9
}
The Flag property to query.
Inherited From:
Returns:
A promise that resolves to the value of given Flag
Type
Promise.<boolean>

getFont()

Retrieves the font used for displaying text in this Widget.
Inherited From:
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.
Inherited From:
Returns:
A promise that resolves to the font size Note: A font size of 0 specifies that the text should be autosized to fit in the Widget.
Type
Promise.<number>

getHIconLeftOver()

Returns the horizontal leftover space of the icon within the annotation.
Inherited From:
Returns:
A promise that resolves to a number indicating the horizontal leftover space of the icon within the annotation. Note: the horizontal leftover is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left. A value of 0.0 shall position the icon at the left of the annotation rectangle. A value of 0.5 shall center it in the horizontal direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5.
Type
Promise.<number>

getHighlightingMode()

Inherited From:
Default Value:
  • e_invert.
Returns:
A promise that resolves to the HighlightingMode of the widget annotation. Note: The annotation's highlighting mode is the visual effect that shall be used when the mouse button is pressed or held down inside its active area Note: A highlighting mode other than e_push will override any down appearance defined for the 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.
Inherited From:
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.
Inherited From:
Returns:
A promise that resolves to a string containing the button down text of the annotation. Note: The button down caption shall be displayed when the mouse button is pressed within its active area.
Type
Promise.<string>

getMouseDownIcon()

Returns the Mouse Down icon associated with the annotation.
Inherited From:
Returns:
A promise that resolves to an SDF object that represents the Mouse Down icon associated with the annotation. Note: The Mouse Down icon object is a form XObject defining the annotation's alternate (down) icon, which shall be displayed when the mouse button is pressed within its active area.
Type
Promise.<PDFNet.Obj>

getOptionalContent()

Returns optional content associated with this annotation.
Inherited From:
Returns:
A promise that resolves to a SDF object corresponding to the group of optional properties. Note: The return value is an Optional Content Group (OCG) or Optional Content Membership Dictionary (PDF::OCG::OCMD) specifying the optional content properties for the annotation. Before the annotation is drawn, its visibility shall be determined based on this entry as well as the annotation flags specified in the Flag entry. If it is determined to be invisible, the annotation shall be skipped, as if it were not in the document.
Type
Promise.<PDFNet.Obj>

getPage()

Gets the page the annotation is associated with.
Inherited From:
Returns:
A promise that resolves to a Page object or null page object if the page reference is not available. The page object returned is an indirect reference to the page object with which this annotation is associated. This entry shall be present in screen annotations associated with rendition actions. Optional. PDF 1.3 PDF 1.4 PDF 1.5 not used in FDF files.
Type
Promise.<PDFNet.Page>

getRect()

Inherited From:
Returns:
A promise that resolves to annotation's bounding rectangle, specified in user space coordinates. The meaning of the rectangle depends on the annotation type. For Link and RubberStamp annotations, the rectangle specifies the area containing the hyperlink area or stamp. For Note annotations, the rectangle is describing the popup window when it's opened. When it's closed, the icon is positioned at lower left corner.
Type
Promise.<PDFNet.Rect>

getRolloverCaptionText()

Returns the rollover caption text of the annotation.
Inherited From:
Returns:
A promise that resolves to a string containing the rollover caption text of the annotation. Note: The rollover caption shall be displayed when the user rolls the cursor into its active area without pressing the mouse button.
Type
Promise.<string>

getRolloverIcon()

Returns the rollover icon associated with the annotation.
Inherited From:
Returns:
A promise that resolves to an SDF object that represents the rollover icon associated with the annotation. Note: The rollover icon object is a form XObject defining the annotation's rollover icon, which shall be displayed when the user rolls the cursor into its active area without pressing the mouse button.
Type
Promise.<PDFNet.Obj>

getRotation()

Returns the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90.
Inherited From:
Returns:
A promise that resolves to an integer representing the rotation value of the annotation. Note: This property is part of the appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.
Type
Promise.<number>

getScaleCondition()

Returns the condition under which the icon should be scaled.
Inherited From:
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.
Inherited From:
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>

getSDFObj()

Inherited From:
Returns:
A promise that resolves to the underlying SDF/Cos object.
Type
Promise.<PDFNet.Obj>

getStaticCaptionText()

Returns static caption text of the annotation.
Inherited From:
Returns:
A promise that resolves to a string containing the static caption text of the annotation. Note: The static caption is the annotation's normal caption, which shall be displayed when it is not interacting with the user. Unlike the remaining entries with the captions, which apply only to widget annotations associated with pushbutton fields, the Static Caption(CA) entry may be used with any type of button field, including check boxes. Note: This property is part of the Widget appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.
Type
Promise.<string>

getStaticIcon()

Returns the static icon associated with the annotation.
Inherited From:
Returns:
A promise that resolves to an SDF object that represents the static icon associated with the annotation. Note: The static icon object is a form XObject defining the annotation's normal icon, which shall be displayed when it is not interacting with the user.
Type
Promise.<PDFNet.Obj>

getStructParent()

Returns the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3)
Inherited From:
Returns:
A promise that resolves to an integer which is the integer key of the annotation's entry in the structural parent tree. Note: The StructParent is the integer key of the annotation's entry in the structural parent tree.
Type
Promise.<number>

getTextColor()

Returns the text color of the Widget Annotation.
Inherited From:
Returns:
A promise that resolves to the text color. Note: the color can be in different color spaces: Gray, RGB, or CMYK. Call "GetTextColorCompNum" to access the color space information corresponding to the border color.
Type
Promise.<Object>

getTriggerAction(trigger)

Get the Action associated with the selected Annot Trigger event.
Parameters:
Name Type Description
trigger number
PDFNet.Annot.EventType = {
	e_action_trigger_activate : 0
	e_action_trigger_annot_enter : 1
	e_action_trigger_annot_exit : 2
	e_action_trigger_annot_down : 3
	e_action_trigger_annot_up : 4
	e_action_trigger_annot_focus : 5
	e_action_trigger_annot_blur : 6
	e_action_trigger_annot_page_open : 7
	e_action_trigger_annot_page_close : 8
	e_action_trigger_annot_page_visible : 9
	e_action_trigger_annot_page_invisible : 10
}
the type of trigger event to get
Inherited From:
Returns:
A promise that resolves to the Action Obj if present, otherwise NULL
Type
Promise.<PDFNet.Obj>

getType()

Inherited From:
Returns:
A promise that resolves to the type of this annotation. Corresponds to the "Subtype" entry of annotation dictionary, as per PDF Reference Manual section 12.5.2
Type
Promise.<number>
Example
Return value enum:
<pre>
PDFNet.Annot.Type = {
	e_Text : 0
	e_Link : 1
	e_FreeText : 2
	e_Line : 3
	e_Square : 4
	e_Circle : 5
	e_Polygon : 6
	e_Polyline : 7
	e_Highlight : 8
	e_Underline : 9
	e_Squiggly : 10
	e_StrikeOut : 11
	e_Stamp : 12
	e_Caret : 13
	e_Ink : 14
	e_Popup : 15
	e_FileAttachment : 16
	e_Sound : 17
	e_Movie : 18
	e_Widget : 19
	e_Screen : 20
	e_PrinterMark : 21
	e_TrapNet : 22
	e_Watermark : 23
	e_3D : 24
	e_Redact : 25
	e_Projection : 26
	e_RichMedia : 27
	e_Unknown : 28
}
</pre>

getUniqueID()

Inherited From:
Returns:
A promise that resolves to the unique identifier for this annotation, or NULL if the identifier is not available. The returned value is a String object and is the value of the "NM" field, which was added as an optional attribute in PDF 1.4.
Type
Promise.<PDFNet.Obj>

getVIconLeftOver()

Returns the vertical leftover space of the icon within the annotation.
Inherited From:
Returns:
A promise that resolves to a number indicating the vertical leftover space of the icon within the annotation. Note: the vertical leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the bottom of the icon. A value of 0.0 shall position the icon at the bottom of the annotation rectangle. A value of 0.5 shall center it in the vertical direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5.
Type
Promise.<number>

getVisibleContentBox()

It is possible during viewing that GetRect does not return the most accurate bounding box of what is actually rendered. This method calculates the bounding box, rather than relying on what is specified in the PDF document. The bounding box is defined as the smallest rectangle that includes all the visible content on the annotation.
Inherited From:
Returns:
A promise that resolves to the bounding box for this annotation. The dimensions are specified in user space coordinates.
Type
Promise.<PDFNet.Rect>

isMarkup()

Return true if this annotation is classified as a markup annotation.
Inherited From:
Returns:
A promise that resolves to boolean value, true if this annotation is classified as a markup annotation.
Type
Promise.<boolean>

isValid()

Inherited From:
Returns:
A promise that resolves to true if this is a valid (non-null) annotation, false otherwise. If the function returns false the underlying SDF/Cos object is null or is not valid and the annotation object should be treated as a null object.
Type
Promise.<boolean>

refreshAppearance()

Regenerates the appearance stream for the annotation. This method can be used to auto-generate the annotation appearance after creating or modifying the annotation without providing an explicit appearance or setting the "NeedAppearances" flag in the AcroForm dictionary. Note: If this annotation contains text, and has been added to a rotated page, the text in the annotation may be rotated. If RefreshAppearance is called *after* the annotation is added to a rotated page, then any text will be rotated in the opposite direction of the page rotation. If this method is called *before* the annotation is added to any rotated page, then no counter rotation will be applied. If you wish to call RefreshAppearance on an annotation already added to a rotated page, but you don't want the text to be rotated, you can do one of the following; temporarily un-rotate the page, or, temporarily remove the "Rotate" object from the annotation. To support users adding text annotations while using a PDF viewer, you can also add any viewer rotation to the annotations Rotate object, to have text always rotated correctly, from the users perspective.
Inherited From:
Returns:
Type
Promise.<void>

refreshAppearanceRefreshOptions( [options])

A version of RefreshAppearance allowing custom options to make slight tweaks in behaviour.
Parameters:
Name Type Argument Description
options PDFNet.PDFDoc.RefreshOptions <optional>
The RefreshOptions.
Inherited From:
Returns:
Type
Promise.<void>

removeAppearance( [annot_state] [, app_state])

Removes the annotation's appearance for the given combination of annotation and appearance states.
Parameters:
Name Type Argument Description
annot_state number <optional>
PDFNet.Annot.State = {
	e_normal : 0
	e_rollover : 1
	e_down : 2
}
the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance.
app_state string <optional>
is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotation state.
Inherited From:
Returns:
Type
Promise.<void>

resize(newrect)

Scales the geometry of the annotation so that its appearance would now fit a new rectangle on the page, in user units. Users still have to call RefreshAppearance() later if they want a corresponding appearance stream to be generated for the new rectangle. The main reason for not combining the two operations together is to be able to resize annotations that do not have an appearance stream.
Parameters:
Name Type Description
newrect PDFNet.Rect A reference to the new rectangle to which this annotation has to be resized.
Inherited From:
Returns:
Type
Promise.<void>

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.
Inherited From:
Returns:
Type
Promise.<void>

setActiveAppearanceState(astate)

Sets the annotation's active appearance state. (Required if the appearance dictionary AP contains one or more subdictionaries; PDF 1.2)
Parameters:
Name Type Description
astate string Character string representing the name of the active appearance state. The string used to select the annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary.
Inherited From:
Returns:
Type
Promise.<void>

setAppearance(app_stream [, annot_state] [, app_state])

Sets the annotation's appearance for the given combination of annotation and appearance states. (Optional; PDF 1.2)
Parameters:
Name Type Argument Description
app_stream PDFNet.Obj a content stream defining the new appearance.
annot_state number <optional>
PDFNet.Annot.State = {
	e_normal : 0
	e_rollover : 1
	e_down : 2
}
the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance.
app_state string <optional>
is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotation state.
Inherited From:
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.
Inherited From:
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.
Inherited From:
Returns:
Type
Promise.<void>

setBorderStyle(bs [, oldStyleOnly])

Sets the border style for the annotation.
Parameters:
Name Type Argument Description
bs PDFNet.AnnotBorderStyle New border style for this annotation.
oldStyleOnly boolean <optional>
PDF manual specifies two ways to add border information to an annotation object, either through an array named 'Border' (PDF 1.0), or a dictionary called 'BS' (PDF 1.2) the latter taking precedence over the former. However, if you want to create a border with rounded corners, you can only do that using PDF 1.0 Border specification, in which case if you call SetBorderStyle() set the parameter oldStyleOnly to true. This parameter has a default value of false in the API and does not need to be used otherwise.
Inherited From:
Returns:
Type
Promise.<void>

setColor(col [, numcomp])

Sets an annotation's color. (Optional; PDF 1.1)
Parameters:
Name Type Argument Description
col PDFNet.ColorPt A ColorPt object in RGB or Gray or CMYK color space representing the annotation's color. The ColorPt contains an array of numbers in the range 0.0 to 1.0, representing a color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation The number of array elements determines the color space in which the color shall be defined: 0 No color; transparent 1 DeviceGray 3 DeviceRGB 4 DeviceCMYK
numcomp number <optional>
The number of color components used to represent the color (i.e. 1, 3, 4).
Inherited From:
Returns:
Type
Promise.<void>

setColorDefault(col)

Parameters:
Name Type Description
col PDFNet.ColorPt
Inherited From:
Returns:
Type
Promise.<void>

setContents(contents)

Sets the content of this annotation. (Optional).
Parameters:
Name Type Description
contents string A reference to unicode string object with the text that will be associated with this annotation. This is the text that annotation displays on user interaction, if the annotation type supports it.
Inherited From:
Returns:
Type
Promise.<void>

setCustomData(key, value)

Sets the custom data associated with the specified key.
Parameters:
Name Type Description
key string The key under which to store this custom data
value string The custom data string to store
Inherited From:
Returns:
Type
Promise.<void>

setDate(date)

Sets an annotation's last modified date.
Parameters:
Name Type Description
date PDFNet.Date The annotation's last modified time and date. Corresponds to the "M" entry of the annotation dictionary.
Inherited From:
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. Note: the fit full flag, if true, indicates that the button appearance shall be scaled to fit fully within the bounds of the annotation without taking into consideration the line width of the border. Default value: false.
Inherited From:
Returns:
Type
Promise.<void>

setFlag(flag, value)

Sets the value of given Flag.
Parameters:
Name Type Description
flag number
PDFNet.Annot.Flag = {
	e_invisible : 0
	e_hidden : 1
	e_print : 2
	e_no_zoom : 3
	e_no_rotate : 4
	e_no_view : 5
	e_annot_read_only : 6
	e_locked : 7
	e_toggle_no_view : 8
	e_locked_contents : 9
}
The Flag property to modify.
value boolean The new value for the property.
Inherited From:
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.
Inherited From:
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 Note: A font size of 0 specifies that the text should be autosized to fit in the Widget.
Inherited From:
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. Note: the horizontal leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left. A value of 0.0 shall position the icon at the left of the annotation rectangle. A value of 0.5 shall center it in the horizontal direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5.
Inherited From:
Returns:
Type
Promise.<void>

setHighlightingMode( [value])

Sets the HighlightingMode for the widget annotation. Note: The annotation's highlighting mode is the visual effect that shall be used when the mouse button is pressed or held down inside its active area
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. Note: A highlighting mode other than e_push shall override any down appearance defined for the annotation. Default value: e_invert.
Inherited From:
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.
Inherited From:
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. Note: The button down caption shall be displayed when the mouse button is pressed within its active area.
Inherited From:
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. Note: The Mouse Down icon object is a form XObject defining the annotation's alternate (down) icon, which shall be displayed when the mouse button is pressed within its active area.
Inherited From:
Returns:
Type
Promise.<void>

setOptionalContent(content)

Associates optional content with this annotation. (Optional, PDF1.5).
Parameters:
Name Type Description
content PDFNet.Obj A pointer to an SDF object corresponding to the optional content, a PDF::OCG::Group or membership dictionary specifying the PDF::OCG::Group properties for the annotation. Before the annotation is drawn, its visibility shall be determined based on this entry as well as the annotation flags specified in the Flag entry . If it is determined to be invisible, the annotation shall be skipped, as if it were not in the document.
Inherited From:
Returns:
Type
Promise.<void>

setPage(page)

Sets the reference to a page the annotation is associated with. (Optional PDF 1.3; not used in FDF files)
Parameters:
Name Type Description
page PDFNet.Page The page object user wants the annotation to be associated with. Note: The parameter should be an indirect reference to the page object with which this annotation is associated. This entry shall be present in screen annotations associated with rendition actions
Inherited From:
Returns:
Type
Promise.<void>

setRect(pos)

Sets the size and location of an annotation on its page.
Parameters:
Name Type Description
pos PDFNet.Rect Annotation's bounding rectangle, specified in user space coordinates. The meaning of the rectangle depends on the annotation type. For Link and RubberStamp annotations, the rectangle specifies the area containing the hyperlink area or stamp. For Note annotations, the rectangle is describing the popup window when it's opened. When it's closed, the icon is positioned at lower left corner.
Inherited From:
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. Note: The rollover caption shall be displayed when the user rolls the cursor into its active area without pressing the mouse button.
Inherited From:
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. Note: The rollover icon object is a form XObject defining the annotation's rollover icon, which shall be displayed when the user rolls the cursor into its active area without pressing the mouse button.
Inherited From:
Returns:
Type
Promise.<void>

setRotation(angle)

Sets the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90. (Optional)
Parameters:
Name Type Description
angle number An integer representing the rotation value of the annotation. Note: This property is part of the appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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. Note: The static caption is the annotation's normal caption, which shall be displayed when it is not interacting with the user. Unlike the remaining entries with the captions, which apply only to widget annotations associated with pushbutton fields, the Static Caption(CA) entry may be used with any type of button field, including check boxes. Note: This property is part of the Widget appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.
Inherited From:
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. Note: The static icon object is a form XObject defining the annotation's normal icon, which shall be displayed when it is not interacting with the user.
Inherited From:
Returns:
Type
Promise.<void>

setStructParent(parkeyval)

Sets the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3)
Parameters:
Name Type Description
parkeyval number An integer which is the integer key of the annotation's entry in the structural parent tree. Note: The StructParent is the integer key of the annotation's entry in the structural parent tree.
Inherited From:
Returns:
Type
Promise.<void>

setTextColor(color, col_comp)

Sets the text color of the Widget Annotation.
Parameters:
Name Type Description
color PDFNet.ColorPt ColorPt object representing the color.
col_comp number 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".
Inherited From:
Returns:
Type
Promise.<void>

setUniqueID(id)

Sets the unique identifier for this annotation.
Parameters:
Name Type Description
id ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray A buffer containing a unique identifier for this annotation. Note: It is necessary to ensure that the unique ID generated is actually unique.
Inherited From:
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. Note: the vertical leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the bottom of the icon. A value of 0.0 shall position the icon at the bottom of the annotation rectangle. A value of 0.5 shall center it in the vertical direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5.
Inherited From:
Returns:
Type
Promise.<void>