public class

WidgetAnnotation

extends LinkAnnotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.LinkAnnotation
       ↳ com.pspdfkit.annotations.WidgetAnnotation

Class Overview

Represents the appearance of a field in interactive forms. For form elements with text, the text color comes from the color property of Annotation. Use getFormElement() to access associated FormElement.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Methods
Action getAdditionalAction(AnnotationTriggerEvent triggerEvent)
Returns the action that should be executed on annotation trigger event.
Map<AnnotationTriggerEventAction> getAdditionalActions()
Returns a map of additional actions keyed by their trigger events.
int getBorderColor()
Returns the border color of this annotation or TRANSPARENT if no color is set.
FormElement getFormElement()
Returns a form element for widget annotation.
Maybe<FormElement> getFormElementAsync()
Returns a form element for widget annotation, asynchronously.
float getTextSize()
Returns the text size set to this annotation.
AnnotationType getType()
Gets the annotation type of the annotation.
void setAdditionalAction(AnnotationTriggerEvent triggerEvent, Action action)
Sets the action that should be executed for the given annotation trigger event.
void setBorderColor(int color)
Sets the border color for this annotation.
[Expand]
Inherited Methods
From class com.pspdfkit.annotations.LinkAnnotation
From class com.pspdfkit.annotations.Annotation
From class java.lang.Object

Public Methods

public Action getAdditionalAction (AnnotationTriggerEvent triggerEvent)

Returns the action that should be executed on annotation trigger event.

Returns
  • Action to be performed once the trigger event occurs.

public Map<AnnotationTriggerEventAction> getAdditionalActions ()

Returns a map of additional actions keyed by their trigger events.

Returns
  • Additional actions dictionary or null if no additional actions are set.

public int getBorderColor ()

Returns the border color of this annotation or TRANSPARENT if no color is set. Note that alpha channel is not taken into account as per PDF specifications.

Returns
  • Color of annotations border or TRANSPARENT if no color is set.

public FormElement getFormElement ()

Returns a form element for widget annotation.

Note: this call may block for a while and should not be invoked on the main thread.

Note: This call requires forms feature in your license.

Returns
  • A form element value or null if it doesn't exist.

public Maybe<FormElement> getFormElementAsync ()

Returns a form element for widget annotation, asynchronously.

Note: This call requires forms feature in your license.

Returns
  • Maybe emitting the FormElement or just completing in case the form element is null.

public float getTextSize ()

Returns the text size set to this annotation.

Returns
  • Text size for this annotation (in PDF points).

public AnnotationType getType ()

Gets the annotation type of the annotation.

Returns
  • The type of the annotation. Makes down casting easier.

public void setAdditionalAction (AnnotationTriggerEvent triggerEvent, Action action)

Sets the action that should be executed for the given annotation trigger event.

Parameters
triggerEvent Event for which to set the action.
action Action to be executed when triggerEvent occurs, null to remove existing action.

public void setBorderColor (int color)

Sets the border color for this annotation. Border color usually redirects to color, unless overridden to have a real backing store (this is the case for WidgetAnnotation).

Note: The annotation will only store the RGB part and discard the alpha channel set here. Annotation opacity is set via the setAlpha(float) property.

Parameters
color The border color or TRANSPARENT to clear the field.