Class PDChoiceField
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.form.PDField
-
- org.apache.pdfbox.pdmodel.interactive.form.PDVariableText
-
- org.apache.pdfbox.pdmodel.interactive.form.PDChoiceField
-
- All Implemented Interfaces:
COSObjectable
public class PDChoiceField extends PDVariableText
A class for handling the PDF field as a choicefield.- Version:
- $Revision: 1.7 $
- Author:
- sug
-
-
Field Summary
Fields Modifier and Type Field Description static intFLAG_COMBOA Ff flag.static intFLAG_EDITA Ff flag.-
Fields inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDVariableText
FLAG_COMB, FLAG_DO_NOT_SCROLL, FLAG_DO_NOT_SPELL_CHECK, FLAG_FILE_SELECT, FLAG_MULTILINE, FLAG_PASSWORD, FLAG_RICH_TEXT, QUADDING_CENTERED, QUADDING_LEFT, QUADDING_RIGHT
-
Fields inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDField
FLAG_NO_EXPORT, FLAG_READ_ONLY, FLAG_REQUIRED
-
-
Constructor Summary
Constructors Constructor Description PDChoiceField(PDAcroForm theAcroForm, COSDictionary field)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description COSArraygetOptions()This will get the option values "Opt".COSArraygetSelectedOptions()This will get the indices of the selected options "I".intgetTopIndex()This will get the top index "TI" value.voidsetValue(java.lang.String optionValue)setValue sets the fields value to a given string.-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDVariableText
doNotScroll, doNotSpellCheck, getDefaultAppearance, getQ, getValue, isFileSelect, isMultiline, isPassword, isRichText, setComb, setDoNotScroll, setDoNotSpellCheck, setFileSelect, setMultiline, setPassword, setQ, setRichText, shouldComb
-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDField
findFieldType, findKid, getAcroForm, getActions, getAlternateFieldName, getCOSObject, getDictionary, getFieldFlags, getFieldType, getFullyQualifiedName, getKids, getParent, getPartialName, getWidget, getWidgets, importFDF, isNoExport, isReadonly, isRequired, setAcroForm, setActions, setAlternateFieldName, setFieldFlags, setFieldType, setKids, setNoExport, setParent, setPartialName, setReadonly, setRequired, toString
-
-
-
-
Field Detail
-
FLAG_COMBO
public static final int FLAG_COMBO
A Ff flag.- See Also:
- Constant Field Values
-
FLAG_EDIT
public static final int FLAG_EDIT
A Ff flag.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PDChoiceField
public PDChoiceField(PDAcroForm theAcroForm, COSDictionary field)
- Parameters:
theAcroForm- The acroForm for this field.field- The field for this choice field.- See Also:
PDField(PDAcroForm,COSDictionary)
-
-
Method Detail
-
setValue
public void setValue(java.lang.String optionValue) throws java.io.IOExceptionDescription copied from class:PDFieldsetValue sets the fields value to a given string.- Overrides:
setValuein classPDVariableText- Parameters:
optionValue- The new value for this text field.- Throws:
java.io.IOException- If there is an error calculating the appearance stream or the value in not one of the existing options.- See Also:
PDField.setValue(java.lang.String)
-
getSelectedOptions
public COSArray getSelectedOptions()
This will get the indices of the selected options "I".- Returns:
- COSArray containing the indices of all selected options.
-
getTopIndex
public int getTopIndex()
This will get the top index "TI" value. The value returned will be the first item to display in the listbox.- Returns:
- the top index, default value 0.
-
getOptions
public COSArray getOptions()
This will get the option values "Opt".- Returns:
- COSArray containing all options.
-
-