public class TextStamp extends Stamp
Reresents textual stamp.
Modifier and Type | Class and Description |
---|---|
static class |
TextStamp.NoCharacterAction
Action to perform if font does not contain required character.
|
Constructor and Description |
---|
TextStamp(FormattedText formattedText)
Initializes a new instance of the
TextStamp class with formattedText object |
TextStamp(FormattedText formattedText,
TextState textState)
Initializes a new instance of the
TextStamp class with formattedText object |
TextStamp(String value)
Initializes a new instance of the
TextStamp class. |
TextStamp(String value,
TextState textState)
Initializes a new instance of the
TextStamp class. |
Modifier and Type | Method and Description |
---|---|
float |
getAutoAdjustFontSizePrecision()
Automatically adjust font size precision.
|
boolean |
getAutoAdjustFontSizeToFitStampRectangle()
If enabled, the font size will be automatically adjusted to fit the stamp rectangle of size:
Width (Stamp#getWidth /Stamp#setWidth(double) )
and Height (Stamp#getHeight /Stamp#setHeight(double) ). |
static Font |
getDefaultFont()
Returns default font
|
static float |
getDefaultFontSize()
Default Font Size
|
boolean |
getDraw()
This property determines how stamp is drawn on page.
|
float |
getFontSize()
Actual font size after the stamp has been placed.
|
double |
getHeight()
Desired height of the stamp on the page.
|
double |
getMaxRowWidth()
Max row height for WordWrap option.
|
int |
getNoCharacterBehavior()
Gets or sets mode that defines behavior in case fonts don't contain requested characters.
|
Font |
getReplacementFont()
Gets or sets font used for replacing if user font does not contain required character.
|
HorizontalAlignment |
getTextAlignment()
Alignment of the text inside the stamp.
|
TextState |
getTextState()
Gets text properties of the stamp.
|
boolean |
getTreatYIndentAsBaseLine()
Defines coordinate origin for placing text.
|
String |
getValue()
Gets string value which is used as stamp on the page.
|
double |
getWidth()
Desired width of the stamp on the page.
|
int |
getWordWrapMode()
Gets or sets the word wrap mode for text rendering.
|
boolean |
isJustify()
Defines text justification.
|
boolean |
isScale()
Defines scaling of the text.
|
boolean |
isWordWrap()
Deprecated.
"Use WordWrapMode instead."
|
void |
put(Page page)
Adds textual stamp on the page.
|
void |
setAutoAdjustFontSizePrecision(float value)
Automatically adjust font size precision.
|
void |
setAutoAdjustFontSizeToFitStampRectangle(boolean value)
If enabled, the font size will be automatically adjusted to fit the stamp rectangle of size:
Width (Stamp#getWidth /Stamp#setWidth(double) )
and Height (Stamp#getHeight /Stamp#setHeight(double) ). |
void |
setDraw(boolean value)
This property determines how stamp is drawn on page.
|
void |
setHeight(double value)
Desired height of the stamp on the page.
|
void |
setJustify(boolean value)
Defines text justification.
|
void |
setMaxRowWidth(double value)
Max row height for WordWrap option.
|
void |
setNoCharacterBehavior(int value)
Gets or sets mode that defines behavior in case fonts don't contain requested characters.
|
void |
setReplacementFont(Font value)
Gets or sets font used for replacing if user font does not contain required character.
|
void |
setScale(boolean value)
Defines scaling of the text.
|
void |
setTextAlignment(HorizontalAlignment value)
Alignment of the text inside the stamp.
|
void |
setTreatYIndentAsBaseLine(boolean value)
Defines coordinate origin for placing text.
|
void |
setValue(String value)
Sets string value which is used as stamp on the page.
|
void |
setWidth(double value)
Desired width of the stamp on the page.
|
void |
setWordWrap(boolean value)
Deprecated.
"Use WordWrapMode instead."
|
void |
setWordWrapMode(int value)
Gets or sets the word wrap mode for text rendering.
|
getBottomMargin, getHorizontalAlignment, getLeftMargin, getOpacity, getOutlineOpacity, getOutlineWidth, getRightMargin, getRotate, getRotateAngle, getStampId, getTopMargin, getVerticalAlignment, getXIndent, getYIndent, getZoom, getZoomX, getZoomY, isBackground, setBackground, setBottomMargin, setHorizontalAlignment, setLeftMargin, setOpacity, setOutlineOpacity, setOutlineWidth, setRightMargin, setRotate, setRotateAngle, setStampId, setTopMargin, setVerticalAlignment, setXIndent, setYIndent, setZoom, setZoomX, setZoomY
public TextStamp(String value)
Initializes a new instance of the TextStamp
class.
value
- Stamp value.public TextStamp(String value, TextState textState)
Initializes a new instance of the TextStamp
class.
value
- Stamp value.textState
- Stamp text state.public TextStamp(FormattedText formattedText)
Initializes a new instance of the TextStamp
class with formattedText object
formattedText
- FormattedText object which contains text of the stamp.public TextStamp(FormattedText formattedText, TextState textState)
Initializes a new instance of the TextStamp
class with formattedText object
formattedText
- FormattedText object which contains text of the stamp.textState
- Stamp text state.public static float getDefaultFontSize()
public boolean getDraw()
This property determines how stamp is drawn on page. If Draw = true stamp is drawn as graphic operators and if draw = false then stamp is drawn as text.
public void setDraw(boolean value)
This property determines how stamp is drawn on page. If Draw = true stamp is drawn as graphic operators and if draw = false then stamp is drawn as text.
value
- boolean valuepublic boolean getTreatYIndentAsBaseLine()
Defines coordinate origin for placing text. If TreatYIndentAsBaseLine = true (default when Draw = true) YIndent value will be treated as text base line. If TreatYIndentAsBaseLine = false (default when Draw = false) YIndent value will be treated as bottom (descent line) of text.
public void setTreatYIndentAsBaseLine(boolean value)
Defines coordinate origin for placing text. If TreatYIndentAsBaseLine = true (default when Draw = true) YIndent value will be treated as text base line. If TreatYIndentAsBaseLine = false (default when Draw = false) YIndent value will be treated as bottom (descent line) of text.
value
- boolean value@Deprecated public boolean isWordWrap()
Defines word wrap. If this property set to true and Width value specified, text will be broken in the several lines to fit into specified width. Default value: false.
@Deprecated public void setWordWrap(boolean value)
Defines word wrap. If this property set to true and Width value specified, text will be broken in the several lines to fit into specified width. Default value: false.
value
- boolean valuepublic final int getWordWrapMode()
Gets or sets the word wrap mode for text rendering.
public final void setWordWrapMode(int value)
Gets or sets the word wrap mode for text rendering.
value
- WordWrapMode elementTextFormattingOptions.WordWrapMode
public boolean isJustify()
Defines text justification. If this property is set to true, both left and right edges of the text are aligned. Default value: false.
public void setJustify(boolean value)
Defines text justification. If this property is set to true, both left and right edges of the text are aligned. Default value: false.
value
- boolean valuepublic boolean isScale()
Defines scaling of the text. If this property is set to true and Width value specified, text will be scaled in order to fit to specified width.
public void setScale(boolean value)
Defines scaling of the text. If this property is set to true and Width value specified, text will be scaled in order to fit to specified width.
value
- boolean valuepublic static Font getDefaultFont()
public String getValue()
Gets string value which is used as stamp on the page.
public void setValue(String value)
Sets string value which is used as stamp on the page.
value
- String valuepublic TextState getTextState()
Gets text properties of the stamp. See TextState
for details.
public HorizontalAlignment getTextAlignment()
Alignment of the text inside the stamp.
HorizontalAlignment
public void setTextAlignment(HorizontalAlignment value)
Alignment of the text inside the stamp.
value
- HorizontalAlignment valueHorizontalAlignment
public final Font getReplacementFont()
Gets or sets font used for replacing if user font does not contain required character.
public final void setReplacementFont(Font value)
Gets or sets font used for replacing if user font does not contain required character.
value
- Font instancepublic final int getNoCharacterBehavior()
Gets or sets mode that defines behavior in case fonts don't contain requested characters.
public final void setNoCharacterBehavior(int value)
Gets or sets mode that defines behavior in case fonts don't contain requested characters.
value
- NoCharacterAction elementpublic void put(Page page)
Adds textual stamp on the page.
public final float getFontSize()
Actual font size after the stamp has been placed. (May differ from the initial font size provided through the constructor if the 'AutoAdjustFontSizeToFitStampRectangle' option is enabled.)
public double getWidth()
Desired width of the stamp on the page.
public void setWidth(double value)
Desired width of the stamp on the page.
public double getHeight()
Desired height of the stamp on the page.
public void setHeight(double value)
Desired height of the stamp on the page.
public double getMaxRowWidth()
Max row height for WordWrap option.
public void setMaxRowWidth(double value)
Max row height for WordWrap option.
value
- double valuepublic final boolean getAutoAdjustFontSizeToFitStampRectangle()
If enabled, the font size will be automatically adjusted to fit the stamp rectangle of size:
Width
(Stamp#getWidth
/Stamp#setWidth(double)
)
and Height
(Stamp#getHeight
/Stamp#setHeight(double)
).
Default width and height are derived from the page rectangle.
public final void setAutoAdjustFontSizeToFitStampRectangle(boolean value)
If enabled, the font size will be automatically adjusted to fit the stamp rectangle of size:
Width
(Stamp#getWidth
/Stamp#setWidth(double)
)
and Height
(Stamp#getHeight
/Stamp#setHeight(double)
).
Default width and height are derived from the page rectangle.
value
- boolean valuepublic final float getAutoAdjustFontSizePrecision()
Automatically adjust font size precision. Default value: 0.1;
public final void setAutoAdjustFontSizePrecision(float value)
Automatically adjust font size precision. Default value: 0.1;
value
- float valueCopyright © 2025 Aspose. All Rights Reserved.