Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.form

public final Class PDTextField

extends PDVariableText
Class Inheritance
Imports
java.io.IOException, org.apache.pdfbox.cos.COSDictionary, .COSName

A text field is a box or space for text fill-in data typically entered from a keyboard. The text may be restricted to a single line or may be permitted to span multiple lines
Author
sug

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
Inherited from org.apache.pdfbox.pdmodel.interactive.form.PDVariableText:
QUADDING_CENTEREDQUADDING_LEFTQUADDING_RIGHT

Constructor Summary

AccessConstructor and Description
public
PDTextField(PDAcroForm
The acroform.
acroForm
)

pack-priv
PDTextField(PDAcroForm
The form that this field is part of.
acroForm
,
COSDictionary
the PDF object to represent as a field.
field
,
PDNonTerminalField
the parent node of the node
parent
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
constructAppearances()

Implements abstract org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.constructAppearances.

Constructs appearance streams and appearance dictionaries for all widget annotations.

public boolean

Returns:

true if the field is not suppose to scroll.
doNotScroll
()

public boolean

Returns:

true if the field is not suppose to spell check.
doNotSpellCheck
()

public String

Returns:

A non-null string.
getDefaultValue
()

Returns the default value of this field, or an empty string.

public int

Returns:

the maximum number of characters, returns -1 if the value isn't present
getMaxLen
()

Returns the maximum number of characters of the text field.

public String

Returns:

A non-null string.
getValue
()

Returns the value of this field, or an empty string.

public String
getValueAsString()

Implements abstract org.apache.pdfbox.pdmodel.interactive.form.PDField.getValueAsString.

Returns a string representation of the "V" entry, or an empty string.

public boolean

Returns:

true if the field is not suppose to comb the text display.
isComb
()

public boolean

Returns:

true if the field is a file select field.
isFileSelect
()

public boolean

Returns:

true if the field is multiline
isMultiline
()

public boolean

Returns:

true if the field is a password field.
isPassword
()

public boolean

Returns:

true if the field is a rich text field.
isRichText
()

public void
setComb(boolean
The value for the comb.
comb
)

Set the comb bit.

public void
setDefaultValue(String
Plain text
value
)

Sets the default value of this field.

public void
setDoNotScroll(boolean
The value for the doNotScroll.
doNotScroll
)

Set the doNotScroll bit.

public void
setDoNotSpellCheck(boolean
The value for the doNotSpellCheck.
doNotSpellCheck
)

Set the doNotSpellCheck bit.

public void
setFileSelect(boolean
The value for the fileSelect.
fileSelect
)

Set the file select bit.

public void
setMaxLen(int
the maximum number of characters
maxLen
)

Sets the maximum number of characters of the text field.

public void
setMultiline(boolean
The value for the multiline.
multiline
)

Set the multiline bit.

public void
setPassword(boolean
The value for the password.
password
)

Set the password bit.

public void
setRichText(boolean
The value for the richText.
richText
)

Set the richText bit.

public void
setValue(String
Plain text
value
)

Implements abstract org.apache.pdfbox.pdmodel.interactive.form.PDField.setValue.

Set the plain text value of this field, and try to update the visual appearance.

Inherited from org.apache.pdfbox.pdmodel.interactive.form.PDVariableText:
getDefaultAppearancegetDefaultAppearanceStringgetDefaultStyleStringgetQgetRichTextValuegetStringOrStreamsetDefaultAppearancesetDefaultStyleStringsetQsetRichTextValue

Field Detail

FLAG_COMBback to summary
private static final int FLAG_COMB
FLAG_DO_NOT_SCROLLback to summary
private static final int FLAG_DO_NOT_SCROLL
FLAG_DO_NOT_SPELL_CHECKback to summary
private static final int FLAG_DO_NOT_SPELL_CHECK
FLAG_FILE_SELECTback to summary
private static final int FLAG_FILE_SELECT
FLAG_MULTILINEback to summary
private static final int FLAG_MULTILINE
FLAG_PASSWORDback to summary
private static final int FLAG_PASSWORD
FLAG_RICH_TEXTback to summary
private static final int FLAG_RICH_TEXT

Constructor Detail

PDTextFieldback to summary
public PDTextField(PDAcroForm acroForm)
Parameters
acroForm:PDAcroForm

The acroform.

See Also
PDField#PDField(PDAcroForm)
PDTextFieldback to summary
pack-priv PDTextField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)

Constructor.

Parameters
acroForm:PDAcroForm

The form that this field is part of.

field:COSDictionary

the PDF object to represent as a field.

parent:PDNonTerminalField

the parent node of the node

Method Detail

constructAppearancesback to summary
pack-priv void constructAppearances() throws IOException

Implements abstract org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.constructAppearances.

Doc from org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.constructAppearances.

Constructs appearance streams and appearance dictionaries for all widget annotations. Subclasses should not call this method directly but via applyChange().

Annotations
@Override
Exceptions
IOException:
if the appearance couldn't be generated
doNotScrollback to summary
public boolean doNotScroll()
Returns:boolean

true if the field is not suppose to scroll.

doNotSpellCheckback to summary
public boolean doNotSpellCheck()
Returns:boolean

true if the field is not suppose to spell check.

getDefaultValueback to summary
public String getDefaultValue()

Returns the default value of this field, or an empty string.

Returns:String

A non-null string.

getMaxLenback to summary
public int getMaxLen()

Returns the maximum number of characters of the text field.

Returns:int

the maximum number of characters, returns -1 if the value isn't present

getValueback to summary
public String getValue()

Returns the value of this field, or an empty string.

Returns:String

A non-null string.

getValueAsStringback to summary
public String getValueAsString()

Implements abstract org.apache.pdfbox.pdmodel.interactive.form.PDField.getValueAsString.

Doc from org.apache.pdfbox.pdmodel.interactive.form.PDField.getValueAsString.

Returns a string representation of the "V" entry, or an empty string.

Returns:String

The list of widget annotations.

Annotations
@Override
isCombback to summary
public boolean isComb()
Returns:boolean

true if the field is not suppose to comb the text display.

isFileSelectback to summary
public boolean isFileSelect()
Returns:boolean

true if the field is a file select field.

isMultilineback to summary
public boolean isMultiline()
Returns:boolean

true if the field is multiline

isPasswordback to summary
public boolean isPassword()
Returns:boolean

true if the field is a password field.

isRichTextback to summary
public boolean isRichText()
Returns:boolean

true if the field is a rich text field.

setCombback to summary
public void setComb(boolean comb)

Set the comb bit.

Parameters
comb:boolean

The value for the comb.

setDefaultValueback to summary
public void setDefaultValue(String value)

Sets the default value of this field.

Parameters
value:String

Plain text

setDoNotScrollback to summary
public void setDoNotScroll(boolean doNotScroll)

Set the doNotScroll bit.

Parameters
doNotScroll:boolean

The value for the doNotScroll.

setDoNotSpellCheckback to summary
public void setDoNotSpellCheck(boolean doNotSpellCheck)

Set the doNotSpellCheck bit.

Parameters
doNotSpellCheck:boolean

The value for the doNotSpellCheck.

setFileSelectback to summary
public void setFileSelect(boolean fileSelect)

Set the file select bit.

Parameters
fileSelect:boolean

The value for the fileSelect.

setMaxLenback to summary
public void setMaxLen(int maxLen)

Sets the maximum number of characters of the text field.

Parameters
maxLen:int

the maximum number of characters

setMultilineback to summary
public void setMultiline(boolean multiline)

Set the multiline bit.

Parameters
multiline:boolean

The value for the multiline.

setPasswordback to summary
public void setPassword(boolean password)

Set the password bit.

Parameters
password:boolean

The value for the password.

setRichTextback to summary
public void setRichText(boolean richText)

Set the richText bit.

Parameters
richText:boolean

The value for the richText.

setValueback to summary
public void setValue(String value) throws IOException

Implements abstract org.apache.pdfbox.pdmodel.interactive.form.PDField.setValue.

Set the plain text value of this field, and try to update the visual appearance.

Parameters
value:String

Plain text

Annotations
@Override
Exceptions
IOException:
if the value could not be set