Class WidgetAnnotation

    • Constructor Detail

      • WidgetAnnotation

        WidgetAnnotation(AnnotationPropertyMap properties, boolean markDirty, String imageResourceId)
        Intended for internal usage only
      • WidgetAnnotation

        WidgetAnnotation(int pageIndex, RectF boundingBox)
        Intended for internal usage only
    • Method Detail

      • getType

        @NonNull() AnnotationType getType()

        Gets the annotation type of the annotation.

        Returns:

        The type of the annotation. Makes down casting easier.

      • getFontSize

        @FloatRange(from = 0.0) float getFontSize()

        Returns the font size of this widget annotation in PDF points. If set to FONT_SIZE_AUTO, PSPDFKit will automatically adjust the font size of the annotation, so that the content fills the bounding box.

        Returns:

        The font size of this widget annotation, or FONT_SIZE_AUTO if auto-sizing of the annotation's content is enabled.

      • setFontSize

         void setFontSize(float fontSize)

        Sets the font size for this widget annotation in PDF points. If set to FONT_SIZE_AUTO, PSPDFKit will automatically adjust the font size of the widget annotation so that its content fills the annotation's bounding box.

        
        // Set a font size of 14 points to a widget annotation.
        widgetAnnotation.setFontSize(14.0f);
        
        // Enable auto-sizing of the annotation's content.
        widgetAnnotation.setFontSize(WidgetAnnotation.FONT_SIZE_AUTO);
        
        Parameters:
        fontSize - The font size to set for this annotation.
      • setVerticalTextAlignment

         void setVerticalTextAlignment(@NonNull() VerticalTextAlignment verticalAlignment)

        Sets the vertical text alignment to use in this widget annotation. One of .

        Parameters:
        verticalAlignment - The vertical alignment to use for the text of this widget annotation.
      • getFormElement

        @Nullable() 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.

      • getFormElementAsync

        @NonNull() 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.

      • setAdditionalAction

         void setAdditionalAction(@NonNull() AnnotationTriggerEvent triggerEvent, @Nullable() 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.
      • getBorderColor

        @ColorInt() int getBorderColor()

        Returns the border color of this annotation or Color#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 Color#TRANSPARENT if no color is set.

      • setBorderColor

         void setBorderColor(@ColorInt() 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 property.

        Parameters:
        color - The border color or Color#TRANSPARENT to clear the field.