FreeTextAnnotation
class FreeTextAnnotation : PdfAnnotation
kotlin.Any | ||
↳ | 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(bounds: RectF, textContent: String) Creates a new free text annotation with the specified bounds and text content. |
Public methods | |
---|---|
Int |
Returns the background color of the freetext annotation. |
RectF |
Returns the bounding rectangle of the freetext annotation. |
Int |
Returns the text color of the freetext annotation. |
String |
Returns the text content of the freetext annotation. |
Unit |
setBackgroundColor(color: Int) Sets the background color of the freetext annotation. |
Unit |
Sets the bounding rectangle of the freetext annotation. |
Unit |
setTextColor(color: Int) Sets the text color of the annotation. |
Unit |
setTextContent(text: String) Sets the text content of the annotation. |
Inherited functions | |
---|---|
Public constructors
FreeTextAnnotation
FreeTextAnnotation(
bounds: RectF,
textContent: String)
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
fun getBackgroundColor(): Int
Returns the background color of the freetext annotation.
Return | |
---|---|
Int |
The background color. |
getBounds
fun getBounds(): RectF
Returns the bounding rectangle of the freetext annotation.
Return | |
---|---|
RectF |
The bounding rectangle. This value cannot be null . |
getTextColor
fun getTextColor(): Int
Returns the text color of the freetext annotation.
Return | |
---|---|
Int |
The text color. |
getTextContent
fun getTextContent(): String
Returns the text content of the freetext annotation.
Return | |
---|---|
String |
The text content. This value cannot be null . |
setBackgroundColor
fun setBackgroundColor(color: Int): Unit
Sets the background color of the freetext annotation.
Parameters | |
---|---|
color |
Int: The new background color. |
setBounds
fun setBounds(bounds: RectF): Unit
Sets the bounding rectangle of the freetext annotation.
Parameters | |
---|---|
bounds |
RectF: The new bounding rectangle. This value cannot be null . |
setTextColor
fun setTextColor(color: Int): Unit
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
fun setTextContent(text: String): Unit
Sets the text content of the annotation.
Parameters | |
---|---|
text |
String: The new text content. This value cannot be null . |