public class StyledText extends Object implements TextFragment
| Constructor and Description |
|---|
StyledText(String text,
float size,
org.apache.pdfbox.pdmodel.font.PDFont font)
Creates a styled text.
|
StyledText(String text,
float size,
org.apache.pdfbox.pdmodel.font.PDFont font,
Color color)
Creates a styled text.
|
StyledText(String text,
float size,
org.apache.pdfbox.pdmodel.font.PDFont font,
Color color,
float baselineOffset)
Creates a styled text.
|
StyledText(String text,
FontDescriptor fontDescriptor)
Creates a styled text.
|
StyledText(String text,
FontDescriptor fontDescriptor,
Color color)
Creates a styled text.
|
StyledText(String text,
FontDescriptor fontDescriptor,
Color color,
float baselineOffset,
float leftMargin,
float rightMargin)
Creates a styled text.
|
| Modifier and Type | Method and Description |
|---|---|
TextSequence |
asSequence() |
float |
getAsent() |
float |
getBaselineOffset() |
Color |
getColor() |
FontDescriptor |
getFontDescriptor() |
float |
getHeight() |
float |
getLeftMargin() |
float |
getRightMargin() |
String |
getText() |
float |
getWidth() |
float |
getWidthWithoutMargin() |
boolean |
hasMargin() |
StyledText |
inheritAttributes(String text) |
StyledText |
inheritAttributes(String text,
float leftMargin,
float rightMargin) |
String |
toString() |
public StyledText(String text, float size, org.apache.pdfbox.pdmodel.font.PDFont font)
text - the text to draw. Must not contain line feeds ('\n').size - the size of the font.font - the font to use.public StyledText(String text, float size, org.apache.pdfbox.pdmodel.font.PDFont font, Color color)
text - the text to draw. Must not contain line feeds ('\n').size - the size of the font.font - the font to use.color - the color to use.public StyledText(String text, float size, org.apache.pdfbox.pdmodel.font.PDFont font, Color color, float baselineOffset)
text - the text to draw. Must not contain line feeds ('\n').size - the size of the font.font - the font to use.color - the color to use.baselineOffset - the offset of the baseline.public StyledText(String text, FontDescriptor fontDescriptor)
text - the text to draw. Must not contain line feeds ('\n').fontDescriptor - the font to use.public StyledText(String text, FontDescriptor fontDescriptor, Color color)
text - the text to draw. Must not contain line feeds ('\n').fontDescriptor - the font to use.color - the color to use.public StyledText(String text, FontDescriptor fontDescriptor, Color color, float baselineOffset, float leftMargin, float rightMargin)
text - the text to draw. Must not contain line feeds ('\n').fontDescriptor - the font to use.color - the color to use.baselineOffset - the offset of the baseline.leftMargin - the margin left to the text.rightMargin - the margin right to the text.public String getText()
getText in interface TextFragmentpublic FontDescriptor getFontDescriptor()
getFontDescriptor in interface TextFragmentpublic float getWidth()
throws IOException
getWidth in interface AreaIOException - by pdfboxpublic float getWidthWithoutMargin()
throws IOException
IOExceptionpublic float getHeight()
throws IOException
getHeight in interface AreaIOException - by pdfboxpublic float getAsent()
throws IOException
IOException - by pdfbox.public float getBaselineOffset()
public Color getColor()
getColor in interface TextFragmentpublic float getLeftMargin()
public float getRightMargin()
public boolean hasMargin()
public TextSequence asSequence()
public StyledText inheritAttributes(String text)
public StyledText inheritAttributes(String text, float leftMargin, float rightMargin)
Copyright © 2022. All rights reserved.