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
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 . |