PdfPageTextObject
class PdfPageTextObject : PdfPageObject
| kotlin.Any | ||
| ↳ | android.graphics.pdf.component.PdfPageObject | |
| ↳ | android.graphics.pdf.component.PdfPageTextObject | |
Represents a text object on a PDF page. This class extends PageObject and provides methods to access and modify the text content.
Summary
| Constants | |
|---|---|
| static Int |
Fill Mode : Only the interior of the glyphs is filled with the fill color. |
| static Int |
FillStroke Mode : Both the interior and outline of the glyphs are rendered using the fill abd stroke colors respectively. |
| static Int |
Stroke Mode : Only the outline of the glyphs is stroked with the stroke color. |
| static Int |
Unknown Render Mode. |
| Public constructors | |
|---|---|
PdfPageTextObject(text: String, font: PdfPageTextObjectFont, fontSize: Float)Constructor for the PdfPageTextObject. |
|
| Public methods | |
|---|---|
| Int |
Returns the fill color of the object. |
| PdfPageTextObjectFont |
getFont()Returns the font of the text. |
| Float |
Returns the font size of the object. |
| Int |
Returns the render mode of the object. |
| Int |
Returns the stroke color of the object. |
| Float |
Returns the stroke width of the object. |
| String |
getText()Returns the text content of the object. |
| Unit |
setFillColor(fillColor: Int)Sets the fill color of the object. |
| Unit |
setRenderMode(renderMode: Int)Sets the android. |
| Unit |
setStrokeColor(strokeColor: Int)Sets the stroke color of the object. |
| Unit |
setStrokeWidth(strokeWidth: Float)Sets the stroke width of the object. |
| Unit |
Sets the text content of the object. |
| Inherited functions | |
|---|---|
Constants
RENDER_MODE_FILL
static val RENDER_MODE_FILL: Int
Fill Mode : Only the interior of the glyphs is filled with the fill color.
Value: 0RENDER_MODE_FILL_STROKE
static val RENDER_MODE_FILL_STROKE: Int
FillStroke Mode : Both the interior and outline of the glyphs are rendered using the fill abd stroke colors respectively.
Value: 2RENDER_MODE_STROKE
static val RENDER_MODE_STROKE: Int
Stroke Mode : Only the outline of the glyphs is stroked with the stroke color.
Value: 1Public constructors
PdfPageTextObject
PdfPageTextObject(
text: String,
font: PdfPageTextObjectFont,
fontSize: Float)
Constructor for the PdfPageTextObject. Sets the object type to TEXT and initializes the text color to black.
| Parameters | |
|---|---|
font |
PdfPageTextObjectFont: The font of the text. This value cannot be null. |
fontSize |
Float: The font size of the text. |
text |
String: This value cannot be null. |
Public methods
getFillColor
fun getFillColor(): Int
Returns the fill color of the object. Returns android.graphics.Color#BLACK by default if not set.
| Return | |
|---|---|
Int |
The fill color of the object. |
getFont
fun getFont(): PdfPageTextObjectFont
Returns the font of the text.
| Return | |
|---|---|
PdfPageTextObjectFont |
A copy of the font object. This value cannot be null. |
getFontSize
fun getFontSize(): Float
Returns the font size of the object.
| Return | |
|---|---|
Float |
The font size. |
getRenderMode
fun getRenderMode(): Int
Returns the render mode of the object.
getStrokeColor
fun getStrokeColor(): Int
Returns the stroke color of the object. Returns android.graphics.Color#BLACK by default if not set.
| Return | |
|---|---|
Int |
The stroke color of the object. |
getStrokeWidth
fun getStrokeWidth(): Float
Returns the stroke width of the object.
| Return | |
|---|---|
Float |
The stroke width of the object. |
getText
fun getText(): String
Returns the text content of the object.
| Return | |
|---|---|
String |
The text content. This value cannot be null. |
setFillColor
fun setFillColor(fillColor: Int): Unit
Sets the fill color of the object. Setting the fillColor will have no effect if android.graphics.pdf.component.PdfPageTextObject.RenderMode is not RENDER_MODE_FILL or RENDER_MODE_FILL_STROKE.
| Parameters | |
|---|---|
fillColor |
Int: The fill color of the object. |
setRenderMode
fun setRenderMode(renderMode: Int): Unit
Sets the android.graphics.pdf.component.PdfPageTextObject.RenderMode of the object.
| Parameters | |
|---|---|
renderMode |
Int: The android.graphics.pdf.component.PdfPageTextObject.RenderMode to be set. Value is android.graphics.pdf.component.PdfPageTextObject#RENDER_MODE_UNKNOWN, android.graphics.pdf.component.PdfPageTextObject#RENDER_MODE_FILL, android.graphics.pdf.component.PdfPageTextObject#RENDER_MODE_STROKE, or android.graphics.pdf.component.PdfPageTextObject#RENDER_MODE_FILL_STROKE |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if the provided renderMode is invalid. |
setStrokeColor
fun setStrokeColor(strokeColor: Int): Unit
Sets the stroke color of the object. Setting the strokeColor will have no effect if android.graphics.pdf.component.PdfPageTextObject.RenderMode is not RENDER_MODE_STROKE or RENDER_MODE_FILL_STROKE.
| Parameters | |
|---|---|
strokeColor |
Int: The stroke color of the object. |
setStrokeWidth
fun setStrokeWidth(strokeWidth: Float): Unit
Sets the stroke width of the object.
| Parameters | |
|---|---|
strokeWidth |
Float: The stroke width of the object. |
setText
fun setText(text: String): Unit
Sets the text content of the object.
| Parameters | |
|---|---|
text |
String: The text content to set. This value cannot be null. |