[]
        
(Showing Draft Content)

WidgetAnnotation

DsPdfJS API v9.1.0


DsPdfJS API / WidgetAnnotation

Class: WidgetAnnotation

Represents a widget annotation used in interactive forms to represent the appearance of fields and to manage user interactions.

Extends

Constructors

Constructor

new WidgetAnnotation(om): WidgetAnnotation

Creates a new WidgetAnnotation.

Parameters

om

ObjectManager

ObjectManager that controls the lifetime of the WidgetAnnotation.

Returns

WidgetAnnotation

Overrides

AnnotationBase.constructor

Constructor

new WidgetAnnotation(): WidgetAnnotation

Creates a new WidgetAnnotation.

Returns

WidgetAnnotation

Overrides

AnnotationBase.constructor

Accessors

activate

Get Signature

get activate(): ActionBase | null

Gets or sets an action to be performed when the annotation is activated.

Returns

ActionBase | null

Set Signature

set activate(value): void

Gets or sets an action to be performed when the annotation is activated.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


annotationPageClosed

Get Signature

get annotationPageClosed(): ActionBase | null

Gets or sets an action to be performed when the page containing the annotation is closed (for example, when the user navigates to the next or previous page, or follows a link annotation or outline item).

Returns

ActionBase | null

Set Signature

set annotationPageClosed(value): void

Gets or sets an action to be performed when the page containing the annotation is closed (for example, when the user navigates to the next or previous page, or follows a link annotation or outline item).

Parameters
value

ActionProperties | ActionBase | null

Returns

void


annotationPageHide

Get Signature

get annotationPageHide(): ActionBase | null

Gets or sets an action to be performed when the page containing the annotation is no longer visible in the viewer application's user interface.

Returns

ActionBase | null

Set Signature

set annotationPageHide(value): void

Gets or sets an action to be performed when the page containing the annotation is no longer visible in the viewer application's user interface.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


annotationPageOpened

Get Signature

get annotationPageOpened(): ActionBase | null

Gets or sets an action to be performed when the page containing the annotation is opened (for example, when the user navigates to it from the next or previous page or by means of a link annotation or outline item).

Returns

ActionBase | null

Set Signature

set annotationPageOpened(value): void

Gets or sets an action to be performed when the page containing the annotation is opened (for example, when the user navigates to it from the next or previous page or by means of a link annotation or outline item).

Parameters
value

ActionProperties | ActionBase | null

Returns

void


annotationPageShow

Get Signature

get annotationPageShow(): ActionBase | null

Gets or sets an action to be performed when the page containing the annotation becomes visible in the viewer application's user interface.

Returns

ActionBase | null

Set Signature

set annotationPageShow(value): void

Gets or sets an action to be performed when the page containing the annotation becomes visible in the viewer application's user interface.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


backColor

Get Signature

get backColor(): Color

Gets or sets the annotation's background color.

Returns

Color

Set Signature

set backColor(value): void

Gets or sets the annotation's background color.

Parameters
value

Color

Returns

void


border

Get Signature

get border(): Border

Gets or sets the annotation border.

Returns

Border

Set Signature

set border(value): void

Gets or sets the annotation border.

Parameters
value

BorderProperties | Border | null

Returns

void


buttonAppearance

Get Signature

get buttonAppearance(): ButtonAppearance

Gets the ButtonAppearance object that specifies the look of the widget if it is linked with a push button field.

Returns

ButtonAppearance


checkStyle

Get Signature

get checkStyle(): CheckStyle | null

Gets or sets the style of check mark that is used if this WidgetAnnotation is linked with a CheckBoxField or a RadioButtonField.

Note that this property works over the 'buttonAppearance.Caption' property, for example if 'checkStyle' is "Cross", then 'buttonAppearance.Caption' will be "8".

If the value of this property is null, it indicates that ButtonAppearance.Caption contains an unknown value.

Returns

CheckStyle | null

Set Signature

set checkStyle(value): void

Gets or sets the style of check mark that is used if this WidgetAnnotation is linked with a CheckBoxField or a RadioButtonField.

Note that this property works over the 'buttonAppearance.Caption' property, for example if 'checkStyle' is "Cross", then 'buttonAppearance.Caption' will be "8".

If the value of this property is null, it indicates that ButtonAppearance.Caption contains an unknown value.

Parameters
value

CheckStyle

Returns

void


contents

Get Signature

get contents(): string | null

Gets or sets the text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation's contents in human-readable form. In either case, this text is useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes.

Returns

string | null

Set Signature

set contents(value): void

Gets or sets the text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation's contents in human-readable form. In either case, this text is useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes.

Parameters
value

string | null

Returns

void

Inherited from

AnnotationBase.contents


defaultAppearance

Get Signature

get defaultAppearance(): DefaultAppearance

Gets the DefaultAppearance object that specifies the visual properties (font, font size etc.) used to format the content of this annotation.

Returns

DefaultAppearance


doc

Get Signature

get doc(): PdfDocument | null

Gets the PdfDocument owning this annotation.

Returns

PdfDocument | null

Inherited from

AnnotationBase.doc


enter

Get Signature

get enter(): ActionBase | null

Gets or sets an action to be performed when the annotation receives the input focus.

Returns

ActionBase | null

Set Signature

set enter(value): void

Gets or sets an action to be performed when the annotation receives the input focus.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


flags

Get Signature

get flags(): AnnotationFlags

Gets or sets the flags specifying various characteristics of the annotation.

Returns

AnnotationFlags

Set Signature

set flags(value): void

Gets or sets the flags specifying various characteristics of the annotation.

Parameters
value

AnnotationFlags

Returns

void

Inherited from

AnnotationBase.flags


highlighting

Get Signature

get highlighting(): HighlightingMode

Gets or sets the annotation's highlighting mode.

Returns

HighlightingMode

Set Signature

set highlighting(value): void

Gets or sets the annotation's highlighting mode.

Parameters
value

HighlightingMode

Returns

void


id

Get Signature

get id(): number

Gets the reference to the object.

Returns

number

Inherited from

AnnotationBase.id


justification

Get Signature

get justification(): VariableTextJustification | null

Gets or sets the justification to be used in displaying the annotation's text. Note that if this property is not specified (the value is null) then Field#justification is used. See PDF specification for details.

Returns

VariableTextJustification | null

Set Signature

set justification(value): void

Gets or sets the justification to be used in displaying the annotation's text. Note that if this property is not specified (the value is null) then Field#justification is used. See PDF specification for details.

Parameters
value

VariableTextJustification | null

Returns

void


leave

Get Signature

get leave(): ActionBase | null

Gets or sets an action to be performed when the annotation loses the input focus.

Returns

ActionBase | null

Set Signature

set leave(value): void

Gets or sets an action to be performed when the annotation loses the input focus.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


locked

Get Signature

get locked(): boolean

Gets or sets a value indicating whether the annotation can be deleted or its properties (including position and size) can be modified by the user. However, this flag does not restrict changes to the annotation's contents, such as the value of a form field.

Returns

boolean

Set Signature

set locked(value): void

Gets or sets a value indicating whether the annotation can be deleted or its properties (including position and size) can be modified by the user. However, this flag does not restrict changes to the annotation's contents, such as the value of a form field.

Parameters
value

boolean

Returns

void

Inherited from

AnnotationBase.locked


lockedContents

Get Signature

get lockedContents(): boolean

Gets or sets a value indicating whether the contents of the annotation can be modified by the user. This flag does not restrict deletion of the annotation or changes to other annotation properties, such as position and size.

Returns

boolean

Set Signature

set lockedContents(value): void

Gets or sets a value indicating whether the contents of the annotation can be modified by the user. This flag does not restrict deletion of the annotation or changes to other annotation properties, such as position and size.

Parameters
value

boolean

Returns

void

Inherited from

AnnotationBase.lockedContents


modifiedDate

Get Signature

get modifiedDate(): PdfDateTime | null

Gets or sets the date and time when the annotation was modified.

Returns

PdfDateTime | null

Set Signature

set modifiedDate(value): void

Gets or sets the date and time when the annotation was modified.

Parameters
value

PdfDateTime | null

Returns

void

Inherited from

AnnotationBase.modifiedDate


mouseDown

Get Signature

get mouseDown(): ActionBase | null

Gets or sets an action to be performed when the mouse button is pressed inside the field's active area.

Returns

ActionBase | null

Set Signature

set mouseDown(value): void

Gets or sets an action to be performed when the mouse button is pressed inside the field's active area.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


mouseEnter

Get Signature

get mouseEnter(): ActionBase | null

Gets or sets an action to be performed when the mouse enters the field's active area.

Returns

ActionBase | null

Set Signature

set mouseEnter(value): void

Gets or sets an action to be performed when the mouse enters the field's active area.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


mouseLeave

Get Signature

get mouseLeave(): ActionBase | null

Gets or sets an action to be performed when the cursor exits the field's active area.

Returns

ActionBase | null

Set Signature

set mouseLeave(value): void

Gets or sets an action to be performed when the cursor exits the field's active area.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


mouseUp

Get Signature

get mouseUp(): ActionBase | null

Gets or sets an action to be performed when the mouse button is released inside the field's active area.

Returns

ActionBase | null

Set Signature

set mouseUp(value): void

Gets or sets an action to be performed when the mouse button is released inside the field's active area.

Parameters
value

ActionProperties | ActionBase | null

Returns

void


name

Get Signature

get name(): string | null

Gets or sets the name of the annotation. If WidgetAnnotation is used with RadioButtonField then name is used as a value.

Returns

string | null

Set Signature

set name(value): void

Gets or sets the name of the annotation. If WidgetAnnotation is used with RadioButtonField then name is used as a value.

Parameters
value

string | null

Returns

void

Overrides

AnnotationBase.name


om

Get Signature

get om(): ObjectManager

Gets the owner ObjectManager instance.

Returns

ObjectManager

Inherited from

AnnotationBase.om


page

Get Signature

get page(): PdfPage | null

Gets or sets the PdfPage that contains this annotation. Note that an annotation may be referenced by several pages. In that case this property returns the first element in the pages collection. When setting this property, the following applies: If the new value is null, this annotation is removed from all pages. Otherwise, this annotation is assigned exclusively to the specified page.

Returns

PdfPage | null

Set Signature

set page(value): void

Gets or sets the PdfPage that contains this annotation. Note that an annotation may be referenced by several pages. In that case this property returns the first element in the pages collection. When setting this property, the following applies: If the new value is null, this annotation is removed from all pages. Otherwise, this annotation is assigned exclusively to the specified page.

Parameters
value

PdfPage | null

Returns

void

Inherited from

UnknownAnnotation.page


pages

Get Signature

get pages(): AnnotationPagesCollection

Gets the list of pages that reference this annotation.

Returns

AnnotationPagesCollection

Inherited from

AnnotationBase.pages


pdfRect

Get Signature

get pdfRect(): Rect

Gets or sets the rectangle that defines the location and size of the annotation on a page in PDF user space coordinates. The positive X axis extends horizontally to the right, and the positive Y axis extends vertically upward, with the origin usually in the lower left corner of the page.

See

rect

Returns

Rect

Set Signature

set pdfRect(value): void

Gets or sets the rectangle that defines the location and size of the annotation on a page in PDF user space coordinates. The positive X axis extends horizontally to the right, and the positive Y axis extends vertically upward, with the origin usually in the lower left corner of the page.

See

rect

Parameters
value

Rect

Returns

void

Inherited from

AnnotationBase.pdfRect


rect

Get Signature

get rect(): Rect

Gets or sets the rectangle that defines the location and size of the annotation on a page. The coordinates of the rectangle are relative to the upper left corner of the page's media box, with the Y (vertical) coordinates increasing from top to bottom. Note that if the annotation is associated with more than one page, the media box of the first of those pages is used to calculate the rectangle's location.

Returns

Rect

Set Signature

set rect(value): void

Gets or sets the rectangle that defines the location and size of the annotation on a page. The coordinates of the rectangle are relative to the upper left corner of the page's media box, with the Y (vertical) coordinates increasing from top to bottom. Note that if the annotation is associated with more than one page, the media box of the first of those pages is used to calculate the rectangle's location.

Parameters
value

Rect

Returns

void

Inherited from

UnknownAnnotation.rect


rotationAngle

Get Signature

get rotationAngle(): number

Gets or sets the angle, in degrees, by which the widget annotation is rotated counterclockwise relative to the page. The value must be a multiple of 90.

Returns

number

Set Signature

set rotationAngle(value): void

Gets or sets the angle, in degrees, by which the widget annotation is rotated counterclockwise relative to the page. The value must be a multiple of 90.

Parameters
value

number

Returns

void

Methods

free()

free(): void

Detaches the object from the ObjectManager and deallocates its memory, if possible.

Returns

void

Inherited from

AnnotationBase.free


rebind()

rebind(omTo): void

Rebinds the object from the current ObjectManager to the specified one.

Parameters

omTo

ObjectManager

The new ObjectManager for the object.

Returns

void

Inherited from

AnnotationBase.rebind


removeAppearance()

removeAppearance(): void

Removes all appearance streams associated with the current annotation, and disables generation of appearance steams for this annotation when the document is saved.

Note that if any property affecting the annotation's appearance 'rect' is then changed, the appearance streams will be regenerated. So this method would usually be called after initializing all annotation's properties.

Returns

void

Inherited from

AnnotationBase.removeAppearance


resetAppearance()

resetAppearance(): void

Forces regeneration of the annotation's appearance streams next time the document is saved.

Returns

void

Inherited from

AnnotationBase.resetAppearance