PdfPageTextObject
public final class PdfPageTextObject
extends PdfPageObject
| java.lang.Object | ||
| ↳ | 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 | |
|---|---|
int | RENDER_MODE_FILL Fill Mode : Only the interior of the glyphs is filled with the fill color. |
int | RENDER_MODE_FILL_STROKE FillStroke Mode : Both the interior and outline of the glyphs are rendered using the fill abd stroke colors respectively. |
int | RENDER_MODE_STROKE Stroke Mode : Only the outline of the glyphs is stroked with the stroke color. |
int | RENDER_MODE_UNKNOWN Unknown Render Mode. |
Public constructors | |
|---|---|
PdfPageTextObject(String text, PdfPageTextObjectFont font, float fontSize) Constructor for the PdfPageTextObject. | |
Public methods | |
|---|---|
int | getFillColor() Returns the fill color of the object. |
PdfPageTextObjectFont | getFont() Returns the font of the text. |
float | getFontSize() Returns the font size of the object. |
int | getRenderMode() Returns the render mode of the object. |
int | getStrokeColor() Returns the stroke color of the object. |
float | getStrokeWidth() Returns the stroke width of the object. |
String | getText() Returns the text content of the object. |
void | setFillColor(int fillColor) Sets the fill color of the object. |
void | setRenderMode(int renderMode) Sets the |
void | setStrokeColor(int strokeColor) Sets the stroke color of the object. |
void | setStrokeWidth(float strokeWidth) Sets the stroke width of the object. |
void | setText(String text) Sets the text content of the object. |
Inherited methods | |
|---|---|
Constants
RENDER_MODE_FILL
public static final int RENDER_MODE_FILL
Fill Mode : Only the interior of the glyphs is filled with the fill color.
Constant Value: 0 (0x00000000)
RENDER_MODE_FILL_STROKE
public static final int RENDER_MODE_FILL_STROKE
FillStroke Mode : Both the interior and outline of the glyphs are rendered using the fill abd stroke colors respectively.
Constant Value: 2 (0x00000002)
RENDER_MODE_STROKE
public static final int RENDER_MODE_STROKE
Stroke Mode : Only the outline of the glyphs is stroked with the stroke color.
Constant Value: 1 (0x00000001)
RENDER_MODE_UNKNOWN
public static final int RENDER_MODE_UNKNOWN
Unknown Render Mode.
Constant Value: -1 (0xffffffff)
Public constructors
PdfPageTextObject
public PdfPageTextObject (String text, PdfPageTextObjectFont font, float fontSize)
Constructor for the PdfPageTextObject. Sets the object type to TEXT and initializes the text color to black.
| Parameters | |
|---|---|
text | String: This value cannot be null. |
font | PdfPageTextObjectFont: The font of the text. This value cannot be null. |
fontSize | float: The font size of the text. |
Public methods
getFillColor
public int getFillColor ()
Returns the fill color of the object. Returns Color.BLACK by default if not set.
| Returns | |
|---|---|
int | The fill color of the object. |
getFont
public PdfPageTextObjectFont getFont ()
Returns the font of the text.
| Returns | |
|---|---|
PdfPageTextObjectFont | A copy of the font object. This value cannot be null. |
getFontSize
public float getFontSize ()
Returns the font size of the object.
| Returns | |
|---|---|
float | The font size. |
getRenderMode
public int getRenderMode ()
Returns the render mode of the object.
| Returns | |
|---|---|
int | The render mode of the object. Value is RENDER_MODE_UNKNOWN, RENDER_MODE_FILL, RENDER_MODE_STROKE, or RENDER_MODE_FILL_STROKE |
getStrokeColor
public int getStrokeColor ()
Returns the stroke color of the object. Returns Color.BLACK by default if not set.
| Returns | |
|---|---|
int | The stroke color of the object. |
getStrokeWidth
public float getStrokeWidth ()
Returns the stroke width of the object.
| Returns | |
|---|---|
float | The stroke width of the object. |
getText
public String getText ()
Returns the text content of the object.
| Returns | |
|---|---|
String | The text content. This value cannot be null. |
setFillColor
public void setFillColor (int fillColor)
Sets the fill color of the object. Setting the fillColor will have no effect if ERROR(RenderMode/android.graphics.pdf.component.PdfPageTextObject.RenderMode RenderMode) is not RENDER_MODE_FILL or RENDER_MODE_FILL_STROKE.
| Parameters | |
|---|---|
fillColor | int: The fill color of the object. |
setRenderMode
public void setRenderMode (int renderMode)
Sets the ERROR(PdfPageTextObject.RenderMode/android.graphics.pdf.component.PdfPageTextObject.RenderMode PdfPageTextObject.RenderMode) of the object.
| Parameters | |
|---|---|
renderMode | int: The ERROR(PdfPageTextObject.RenderMode/android.graphics.pdf.component.PdfPageTextObject.RenderMode PdfPageTextObject.RenderMode) to be set. Value is RENDER_MODE_UNKNOWN, RENDER_MODE_FILL, RENDER_MODE_STROKE, or RENDER_MODE_FILL_STROKE |
| Throws | |
|---|---|
IllegalArgumentException | if the provided renderMode is invalid. |
setStrokeColor
public void setStrokeColor (int strokeColor)
Sets the stroke color of the object. Setting the strokeColor will have no effect if ERROR(RenderMode/android.graphics.pdf.component.PdfPageTextObject.RenderMode RenderMode) is not RENDER_MODE_STROKE or RENDER_MODE_FILL_STROKE.
| Parameters | |
|---|---|
strokeColor | int: The stroke color of the object. |
setStrokeWidth
public void setStrokeWidth (float strokeWidth)
Sets the stroke width of the object.
| Parameters | |
|---|---|
strokeWidth | float: The stroke width of the object. |
setText
public void setText (String text)
Sets the text content of the object.
| Parameters | |
|---|---|
text | String: The text content to set. This value cannot be null. |