org.pdfbox.pdmodel.interactive.form

Class PDVariableText

Implemented Interfaces:
COSObjectable
Known Direct Subclasses:
PDChoiceField, PDTextbox

public abstract class PDVariableText
extends PDField

A class for handling PDF fields that display text.
Version:
$Revision: 1.7 $
Author:
Ben Litchfield

Field Summary

static int
FLAG_COMB
A Ff flag.
static int
FLAG_DO_NOT_SCROLL
A Ff flag.
static int
FLAG_DO_NOT_SPELL_CHECK
A Ff flag.
static int
FLAG_FILE_SELECT
A Ff flag.
static int
FLAG_MULTILINE
A Ff flag.
static int
FLAG_PASSWORD
A Ff flag.
static int
FLAG_RICH_TEXT
A Ff flag.
static int
QUADDING_CENTERED
A Q value.
static int
QUADDING_LEFT
A Q value.
static int
QUADDING_RIGHT
A Q value.

Fields inherited from class org.pdfbox.pdmodel.interactive.form.PDField

FLAG_NO_EXPORT, FLAG_READ_ONLY, FLAG_REQUIRED

Constructor Summary

PDVariableText(PDAcroForm theAcroForm)
PDVariableText(PDAcroForm theAcroForm, COSDictionary field)

Method Summary

boolean
doNotScroll()
boolean
doNotSpellCheck()
protected COSString
getDefaultAppearance()
int
getQ()
This will get the 'quadding' or justification of the text to be displayed.
String
getValue()
getValue gets the fields value to as a string.
boolean
isFileSelect()
boolean
isMultiline()
boolean
isPassword()
boolean
isRichText()
void
setComb(boolean comb)
Set the comb bit.
void
setDoNotScroll(boolean doNotScroll)
Set the doNotScroll bit.
void
setDoNotSpellCheck(boolean doNotSpellCheck)
Set the doNotSpellCheck bit.
void
setFileSelect(boolean fileSelect)
Set the file select bit.
void
setMultiline(boolean multiline)
Set the multiline bit.
void
setPassword(boolean password)
Set the password bit.
void
setQ(int q)
This will set the quadding/justification of the text.
void
setRichText(boolean richText)
Set the richText bit.
void
setValue(String value)
boolean
shouldComb()

Methods inherited from class org.pdfbox.pdmodel.interactive.form.PDField

findFieldType, findKid, getAcroForm, getActions, getCOSObject, getDictionary, getFieldFlags, getFieldType, getFullyQualifiedName, getKids, getParent, getPartialName, getValue, getWidget, importFDF, isNoExport, isReadonly, isRequired, setAcroForm, setActions, setFieldFlags, setKids, setNoExport, setParent, setPartialName, setReadonly, setRequired, setValue, toString

Field Details

FLAG_COMB

public static final int FLAG_COMB
A Ff flag.
Field Value:
16777216

FLAG_DO_NOT_SCROLL

public static final int FLAG_DO_NOT_SCROLL
A Ff flag.
Field Value:
8388608

FLAG_DO_NOT_SPELL_CHECK

public static final int FLAG_DO_NOT_SPELL_CHECK
A Ff flag.
Field Value:
4194304

FLAG_FILE_SELECT

public static final int FLAG_FILE_SELECT
A Ff flag.
Field Value:
1048576

FLAG_MULTILINE

public static final int FLAG_MULTILINE
A Ff flag.
Field Value:
4096

FLAG_PASSWORD

public static final int FLAG_PASSWORD
A Ff flag.
Field Value:
8192

FLAG_RICH_TEXT

public static final int FLAG_RICH_TEXT
A Ff flag.
Field Value:
33554432

QUADDING_CENTERED

public static final int QUADDING_CENTERED
A Q value.
Field Value:
1

QUADDING_LEFT

public static final int QUADDING_LEFT
A Q value.
Field Value:
0

QUADDING_RIGHT

public static final int QUADDING_RIGHT
A Q value.
Field Value:
2

Constructor Details

PDVariableText

public PDVariableText(PDAcroForm theAcroForm)
Parameters:
theAcroForm - The acroform.

PDVariableText

public PDVariableText(PDAcroForm theAcroForm,
                      COSDictionary field)
Parameters:
theAcroForm - The acroForm for this field.
field - The field's dictionary.

Method Details

doNotScroll

public boolean doNotScroll()
Returns:
true if the field is not suppose to scroll.

doNotSpellCheck

public boolean doNotSpellCheck()
Returns:
true if the field is not suppose to spell check.

getDefaultAppearance

protected COSString getDefaultAppearance()
Returns:
the DA element of the dictionary object

getQ

public int getQ()
This will get the 'quadding' or justification of the text to be displayed. 0 - Left(default)
1 - Centered
2 - Right
Please see the QUADDING_CONSTANTS.
Returns:
The justification of the text strings.

getValue

public String getValue()
            throws IOException
getValue gets the fields value to as a string.
Overrides:
getValue in interface PDField
Returns:
The string value of this field.

isFileSelect

public boolean isFileSelect()
Returns:
true if the field is a file select field.

isMultiline

public boolean isMultiline()
Returns:
true if the field is multiline

isPassword

public boolean isPassword()
Returns:
true if the field is a password field.

isRichText

public boolean isRichText()
Returns:
true if the field is a rich text field.

setComb

public void setComb(boolean comb)
Set the comb bit.
Parameters:
comb - The value for the comb.

setDoNotScroll

public void setDoNotScroll(boolean doNotScroll)
Set the doNotScroll bit.
Parameters:
doNotScroll - The value for the doNotScroll.

setDoNotSpellCheck

public void setDoNotSpellCheck(boolean doNotSpellCheck)
Set the doNotSpellCheck bit.
Parameters:
doNotSpellCheck - The value for the doNotSpellCheck.

setFileSelect

public void setFileSelect(boolean fileSelect)
Set the file select bit.
Parameters:
fileSelect - The value for the fileSelect.

setMultiline

public void setMultiline(boolean multiline)
Set the multiline bit.
Parameters:
multiline - The value for the multiline.

setPassword

public void setPassword(boolean password)
Set the password bit.
Parameters:
password - The value for the password.

setQ

public void setQ(int q)
This will set the quadding/justification of the text. See QUADDING constants.
Parameters:
q - The new text justification.

setRichText

public void setRichText(boolean richText)
Set the richText bit.
Parameters:
richText - The value for the richText.

setValue

public void setValue(String value)
            throws IOException
Overrides:
setValue in interface PDField
Parameters:
value - The new value for this text field.
See Also:
org.pdfbox.pdmodel.interactive.form.PDField.setValue(java.lang.String)

shouldComb

public boolean shouldComb()
Returns:
true if the field is not suppose to comb the text display.