FreeTextAnnotation


public final class FreeTextAnnotation
extends PdfAnnotation

java.lang.Object
   ↳ android.graphics.pdf.component.PdfAnnotation
     ↳ android.graphics.pdf.component.FreeTextAnnotation


Represents a free text annotation in a PDF document.

This class allows creating and manipulating free text annotations. A free text annotation in a PDF is a type of annotation that allows you to add text directly onto the page.

If text color is not set using setTextColor(int), the default text color is black and if the background color is not set using setBackgroundColor(int), the default background color is white.

Summary

Public constructors

FreeTextAnnotation(RectF bounds, String textContent)

Creates a new free text annotation with the specified bounds and text content.

Public methods

int getBackgroundColor()

Returns the background color of the freetext annotation.

RectF getBounds()

Returns the bounding rectangle of the freetext annotation.

int getTextColor()

Returns the text color of the freetext annotation.

String getTextContent()

Returns the text content of the freetext annotation.

void setBackgroundColor(int color)

Sets the background color of the freetext annotation.

void setBounds(RectF bounds)

Sets the bounding rectangle of the freetext annotation.

void setTextColor(int color)

Sets the text color of the annotation.

void setTextContent(String text)

Sets the text content of the annotation.

Inherited methods

Public constructors

FreeTextAnnotation

Added in S Extensions 18
public FreeTextAnnotation (RectF bounds, 
                String textContent)

Creates a new free text annotation with the specified bounds and text content.

The default text color and background color will be black and white respectively. Also, transparency of the text color can't be modified i.e. alpha value of the text color will always be 1

Parameters
bounds RectF: The bounding rectangle of the annotation. This value cannot be null.

textContent String: The text content of the annotation This value cannot be null.

Public methods

getBackgroundColor

Added in S Extensions 18
public int getBackgroundColor ()

Returns the background color of the freetext annotation.

Returns
int The background color.

getBounds

Added in S Extensions 18
public RectF getBounds ()

Returns the bounding rectangle of the freetext annotation.

Returns
RectF The bounding rectangle. This value cannot be null.

getTextColor

Added in S Extensions 18
public int getTextColor ()

Returns the text color of the freetext annotation.

Returns
int The text color.

getTextContent

Added in S Extensions 18
public String getTextContent ()

Returns the text content of the freetext annotation.

Returns
String The text content. This value cannot be null.

setBackgroundColor

Added in S Extensions 18
public void setBackgroundColor (int color)

Sets the background color of the freetext annotation.

Parameters
color int: The new background color.

setBounds

Added in S Extensions 18
public void setBounds (RectF bounds)

Sets the bounding rectangle of the freetext annotation.

Parameters
bounds RectF: The new bounding rectangle. This value cannot be null.

setTextColor

Added in S Extensions 18
public void setTextColor (int color)

Sets the text color of the annotation.

Please note that the transparency of the color can't be modified. Alpha value of the text color will always be 1 (i.e. fully opaque) even if a color with different alpha value is set using this method

Parameters
color int: The new text color.

setTextContent

Added in S Extensions 18
public void setTextContent (String text)

Sets the text content of the annotation.

Parameters
text String: The new text content. This value cannot be null.