public abstract class PDVariableText extends PDTerminalField
Modifier and Type | Field and Description |
---|---|
static int |
QUADDING_CENTERED |
static int |
QUADDING_LEFT |
static int |
QUADDING_RIGHT |
Constructor and Description |
---|
PDVariableText(PDAcroForm acroForm) |
PDVariableText(PDAcroForm acroForm,
COSDictionary field,
PDNonTerminalField parent)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDefaultAppearance()
Get the default appearance.
|
(package private) PDDefaultAppearanceString |
getDefaultAppearanceString()
Get the default appearance.
|
java.lang.String |
getDefaultStyleString()
Get the default style string.
|
int |
getQ()
This will get the 'quadding' or justification of the text to be displayed.
|
java.lang.String |
getRichTextValue()
Get the fields rich text value.
|
protected java.lang.String |
getStringOrStream(COSBase base)
Get a text as text stream.
|
void |
setDefaultAppearance(java.lang.String daValue)
Set the default appearance.
|
void |
setDefaultStyleString(java.lang.String defaultStyleString)
Set the default style string.
|
void |
setQ(int q)
This will set the quadding/justification of the text.
|
void |
setRichTextValue(java.lang.String richTextValue)
Set the fields rich text value.
|
applyChange, constructAppearances, exportFDF, getFieldFlags, getFieldType, getWidget, getWidgets, importFDF, setActions, setWidgets
findKid, fromDictionary, getAcroForm, getActions, getAlternateFieldName, getCOSObject, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, getValueAsString, isNoExport, isReadOnly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadOnly, setRequired, setValue, toString
public static final int QUADDING_LEFT
public static final int QUADDING_CENTERED
public static final int QUADDING_RIGHT
PDVariableText(PDAcroForm acroForm)
acroForm
- The acroform.PDTerminalField.PDTerminalField(PDAcroForm)
PDVariableText(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
acroForm
- The form that this field is part of.field
- the PDF object to represent as a field.parent
- the parent node of the nodepublic java.lang.String getDefaultAppearance()
PDDefaultAppearanceString getDefaultAppearanceString() throws java.io.IOException
java.io.IOException
public void setDefaultAppearance(java.lang.String daValue)
This method can also be used to change the font of a field, by replacing the font name from
this string with another font name found in the AcroForm default resources before
calling setValue(String)
, see also
this
stackoverflow answer. For example, "/Helv 10 Tf 0 g" can be replaced with "/F1 10 Tf 0
g". Performance may go down (see
PDFBOX-4508) if this is done
for many fields and with a very large font (e.g. ArialUni); to avoid this, save and reload
the file after changing all fields.
daValue
- a string describing the default appearancepublic java.lang.String getDefaultStyleString()
public void setDefaultStyleString(java.lang.String defaultStyleString)
defaultStyleString
- a string describing the default style.public int getQ()
public void setQ(int q)
q
- The new text justification.public java.lang.String getRichTextValue() throws java.io.IOException
java.io.IOException
- if the field dictionary entry is not a text typepublic void setRichTextValue(java.lang.String richTextValue)
Setting the rich text value will not generate the appearance
for the field.
You can set PDAcroForm.setNeedAppearances(Boolean)
to
signal a conforming reader to generate the appearance stream.
richTextValue
- a rich text stringprotected final java.lang.String getStringOrStream(COSBase base)
base
- the potential text or text stream