# PdfPageTextObject

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  
Summary:[Constants](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#constants)\|[Ctors](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#pubctors)\|[Methods](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#inhmethods)  

# PdfPageTextObject

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageTextObject "View this page in Kotlin")\|Java

`
public

final

class
PdfPageTextObject
`  
`


``

extends `[PdfPageObject](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageObject)`


``


`

|---|---|--------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.graphics.pdf.component.PdfPageObject](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageObject) ||
|   | ↳ | android.graphics.pdf.component.PdfPageTextObject |

<br />

*** ** * ** ***

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](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL) Fill Mode : Only the interior of the glyphs is filled with the fill color.                                                              |
| `int` | [RENDER_MODE_FILL_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#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](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_STROKE) Stroke Mode : Only the outline of the glyphs is stroked with the stroke color.                                                      |
| `int` | [RENDER_MODE_UNKNOWN](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_UNKNOWN) Unknown Render Mode.                                                                                                              |

|                                                                                                                                                                                                                                   ### Public constructors                                                                                                                                                                                                                                   ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[PdfPageTextObject](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#PdfPageTextObject(java.lang.String,%20android.graphics.pdf.component.PdfPageTextObjectFont,%20float))`(`[String](https://developer.android.com/reference/java/lang/String)` text, `[PdfPageTextObjectFont](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObjectFont)` font, float fontSize) ` Constructor for the PdfPageTextObject. |

|                                                                                                                                                                                                                        ### Public methods                                                                                                                                                                                                                         ||
|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                                                   | ` `[getFillColor](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#getFillColor())`() ` Returns the fill color of the object.                                                                                                                                                                   |
| ` `[PdfPageTextObjectFont](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObjectFont) | ` `[getFont](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#getFont())`() ` Returns the font of the text.                                                                                                                                                                                     |
| ` float`                                                                                                                 | ` `[getFontSize](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#getFontSize())`() ` Returns the font size of the object.                                                                                                                                                                      |
| ` int`                                                                                                                   | ` `[getRenderMode](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#getRenderMode())`() ` Returns the render mode of the object.                                                                                                                                                                |
| ` int`                                                                                                                   | ` `[getStrokeColor](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#getStrokeColor())`() ` Returns the stroke color of the object.                                                                                                                                                             |
| ` float`                                                                                                                 | ` `[getStrokeWidth](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#getStrokeWidth())`() ` Returns the stroke width of the object.                                                                                                                                                             |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                    | ` `[getText](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#getText())`() ` Returns the text content of the object.                                                                                                                                                                           |
| ` void`                                                                                                                  | ` `[setFillColor](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#setFillColor(int))`(int fillColor) ` Sets the fill color of the object.                                                                                                                                                      |
| ` void`                                                                                                                  | ` `[setRenderMode](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#setRenderMode(int))`(int renderMode) ` Sets the[ERROR(PdfPageTextObject.RenderMode/android.graphics.pdf.component.PdfPageTextObject.RenderMode PdfPageTextObject.RenderMode)](https://developer.android.com/)of the object. |
| ` void`                                                                                                                  | ` `[setStrokeColor](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#setStrokeColor(int))`(int strokeColor) ` Sets the stroke color of the object.                                                                                                                                              |
| ` void`                                                                                                                  | ` `[setStrokeWidth](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#setStrokeWidth(float))`(float strokeWidth) ` Sets the stroke width of the object.                                                                                                                                          |
| ` void`                                                                                                                  | ` `[setText](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#setText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` text) ` Sets the text content of the object.                                                                                     |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.graphics.pdf.component.PdfPageObject](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageObject)` ` |------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` float[]` | ` `[getMatrix](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageObject#getMatrix())`() ` Returns the transformation matrix of the object.                                                                                                                                                                                                          | | ` int`     | ` `[getPdfObjectType](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageObject#getPdfObjectType())`() ` Returns the type of the page object.                                                                                                                                                                                                        | | ` void`    | ` `[setMatrix](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageObject#setMatrix(android.graphics.Matrix))`(`[Matrix](https://developer.android.com/reference/android/graphics/Matrix)` matrix) ` Sets the transformation matrix of the object.                                                                                                    | | ` void`    | ` `[transform](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageObject#transform(float,%20float,%20float,%20float,%20float,%20float))`(float a, float b, float c, float d, float e, float f) ` Transform the page object The matrix is composed as: \|a c e\| \|b d f\| and can be used to scale, rotate, shear and translate the \|page_object\|. | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(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](https://developer.android.com/reference/java/lang/Object#wait(long))`(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](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### RENDER_MODE_FILL

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public static final int RENDER_MODE_FILL
```

Fill Mode : Only the interior of the glyphs is filled with the fill color.

<br />

Constant Value: 0 (0x00000000)  

### RENDER_MODE_FILL_STROKE

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

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

<br />

Constant Value: 2 (0x00000002)  

### RENDER_MODE_STROKE

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public static final int RENDER_MODE_STROKE
```

Stroke Mode : Only the outline of the glyphs is stroked with the stroke color.

<br />

Constant Value: 1 (0x00000001)  

### RENDER_MODE_UNKNOWN

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public static final int RENDER_MODE_UNKNOWN
```

Unknown Render Mode.

<br />

Constant Value: -1 (0xffffffff)

## Public constructors

### PdfPageTextObject

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

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

<br />

|                                          Parameters                                           ||
|------------|-----------------------------------------------------------------------------------|
| `text`     | `String`: This value cannot be`null`. <br />                                      |
| `font`     | `PdfPageTextObjectFont`: The font of the text. This value cannot be`null`. <br /> |
| `fontSize` | `float`: The font size of the text. <br />                                        |

## Public methods

### getFillColor

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public int getFillColor ()
```

Returns the fill color of the object. Returns[Color.BLACK](https://developer.android.com/reference/android/graphics/Color#BLACK)by default if not set.

<br />

|                   Returns                   ||
|-------|--------------------------------------|
| `int` | The fill color of the object. <br /> |

### getFont

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public PdfPageTextObjectFont getFont ()
```

Returns the font of the text.

<br />

|                                                                                       Returns                                                                                        ||
|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [PdfPageTextObjectFont](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObjectFont) | A copy of the font object. This value cannot be`null`. <br /> |

### getFontSize

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public float getFontSize ()
```

Returns the font size of the object.

<br />

|            Returns             ||
|---------|-----------------------|
| `float` | The font size. <br /> |

### getRenderMode

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public int getRenderMode ()
```

Returns the render mode of the object.

<br />

|                                                                                                                                                                                                                                                                                                 Returns                                                                                                                                                                                                                                                                                                 ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | The render mode of the object. Value is[RENDER_MODE_UNKNOWN](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_UNKNOWN),[RENDER_MODE_FILL](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL),[RENDER_MODE_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_STROKE), or[RENDER_MODE_FILL_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL_STROKE) <br /> |

### getStrokeColor

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public int getStrokeColor ()
```

Returns the stroke color of the object. Returns[Color.BLACK](https://developer.android.com/reference/android/graphics/Color#BLACK)by default if not set.

<br />

|                    Returns                    ||
|-------|----------------------------------------|
| `int` | The stroke color of the object. <br /> |

### getStrokeWidth

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public float getStrokeWidth ()
```

Returns the stroke width of the object.

<br />

|                     Returns                     ||
|---------|----------------------------------------|
| `float` | The stroke width of the object. <br /> |

### getText

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public String getText ()
```

Returns the text content of the object.

<br />

|                                                         Returns                                                          ||
|--------------------------------------------------------------------|------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | The text content. This value cannot be`null`. <br /> |

### setFillColor

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
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)](https://developer.android.com/)is not[RENDER_MODE_FILL](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL)or[RENDER_MODE_FILL_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL_STROKE).

<br />

|                        Parameters                        ||
|-------------|---------------------------------------------|
| `fillColor` | `int`: The fill color of the object. <br /> |

### setRenderMode

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public void setRenderMode (int renderMode)
```

Sets the[ERROR(PdfPageTextObject.RenderMode/android.graphics.pdf.component.PdfPageTextObject.RenderMode PdfPageTextObject.RenderMode)](https://developer.android.com/)of the object.

<br />

|                                                                                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                                                                                             ||
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `renderMode` | `int`: The[ERROR(PdfPageTextObject.RenderMode/android.graphics.pdf.component.PdfPageTextObject.RenderMode PdfPageTextObject.RenderMode)](https://developer.android.com/)to be set. Value is[RENDER_MODE_UNKNOWN](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_UNKNOWN),[RENDER_MODE_FILL](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL),[RENDER_MODE_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_STROKE), or[RENDER_MODE_FILL_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL_STROKE) <br /> |

|                                                                     Throws                                                                     ||
|--------------------------------------------------------------------------------------------------------|----------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the provided renderMode is invalid. |

### setStrokeColor

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
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)](https://developer.android.com/)is not[RENDER_MODE_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_STROKE)or[RENDER_MODE_FILL_STROKE](https://developer.android.com/reference/android/graphics/pdf/component/PdfPageTextObject#RENDER_MODE_FILL_STROKE).

<br />

|                          Parameters                          ||
|---------------|-----------------------------------------------|
| `strokeColor` | `int`: The stroke color of the object. <br /> |

### setStrokeWidth

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public void setStrokeWidth (float strokeWidth)
```

Sets the stroke width of the object.

<br />

|                           Parameters                           ||
|---------------|-------------------------------------------------|
| `strokeWidth` | `float`: The stroke width of the object. <br /> |

### setText

Added in[version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in[S Extensions 18](https://developer.android.com/sdkExtensions)  

```
public void setText (String text)
```

Sets the text content of the object.

<br />

|                                  Parameters                                   ||
|--------|-----------------------------------------------------------------------|
| `text` | `String`: The text content to set. This value cannot be`null`. <br /> |