FreeTextAnnotation  |  API reference  |  Android Developers


public final class FreeTextAnnotation
extends PdfAnnotation



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

From class android.graphics.pdf.component.PdfAnnotation

int getPdfAnnotationType()

Returns the type of the annotation.

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

FreeTextAnnotation

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

public int getBackgroundColor ()

Returns the background color of the freetext annotation.

Returns
int The background color.

getBounds

public RectF getBounds ()

Returns the bounding rectangle of the freetext annotation.

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

getTextColor

public int getTextColor ()

Returns the text color of the freetext annotation.

Returns
int The text color.

getTextContent

public String getTextContent ()

Returns the text content of the freetext annotation.

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

setBackgroundColor

public void setBackgroundColor (int color)

Sets the background color of the freetext annotation.

Parameters
color int: The new background color.

setBounds

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

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

public void setTextContent (String text)

Sets the text content of the annotation.

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