public class TextObject extends PageObject
TextObject
represents a PDF TextObject in Page.
The TextObject
class offers methods to do some operations on text object.
It can be constructed by the following way:
Example:
TextObject textobj = TextObject.create(page);
TYPE_ALL, TYPE_FORMXOBJECT, TYPE_IMAGE, TYPE_PATH, TYPE_SHADING, TYPE_TEXT
Modifier and Type | Method and Description |
---|---|
static TextObject |
create(PDFPage page)
Create a new text object.
|
java.lang.String |
getString()
Get string of current text object.
|
TextState |
getTextState()
Get text states of current text object.
|
int |
getType()
Get type of a page object.
|
void |
setString(java.lang.String str)
Set string to current text object.
|
void |
setTextState(TextState textState,
boolean italic,
int weight)
Set text states to current text object.
|
getFillColor, getHandle, getStrokeColor, release, setFillColor, setMatrix, setStrokeColor
public int getType()
PageObject
getType
in class PageObject
public static TextObject create(PDFPage page) throws PDFException
page
- A PDFPage
object which is a PDF page. It should
be valid.TextObject
object that receives the
text object newly created.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
PDFPage
public TextState getTextState() throws PDFException
TextState
object that receives text state.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public java.lang.String getString() throws PDFException
String
object that receives the string.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setTextState(TextState textState, boolean italic, int weight) throws PDFException
textState
- A TextState
object to be set.italic
- A boolean value which indicates whether the set text is italic or not.weight
- Original font weight, if larger than 500 it indicates bold.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setString(java.lang.String str) throws PDFException
str
- A String
object to be set.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException