Class PDCheckBox
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.form.PDField
-
- org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField
-
- org.apache.pdfbox.pdmodel.interactive.form.PDButton
-
- org.apache.pdfbox.pdmodel.interactive.form.PDCheckBox
-
- All Implemented Interfaces:
COSObjectable
public final class PDCheckBox extends PDButton
A check box toggles between two states, on and off.
-
-
Field Summary
-
Fields inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDButton
FLAG_PUSHBUTTON, FLAG_RADIO, FLAG_RADIOS_IN_UNISON
-
-
Constructor Summary
Constructors Constructor Description PDCheckBox(PDAcroForm acroForm)
PDCheckBox(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check()
Checks the check box.java.lang.String
getOnValue()
Get the value which sets the check box to the On state.boolean
isChecked()
This will tell if this radio button is currently checked or not.void
unCheck()
Unchecks the check box.-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDButton
checkValue, constructAppearances, getDefaultValue, getExportValues, getOnValues, getValue, getValueAsString, isPushButton, isRadioButton, setDefaultValue, setExportValues, setPushButton, setRadioButton, setValue, setValue
-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField
applyChange, exportFDF, getFieldFlags, getFieldType, getWidget, getWidgets, importFDF, setActions, setWidgets
-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDField
findKid, fromDictionary, getAcroForm, getActions, getAlternateFieldName, getCOSObject, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, isNoExport, isReadOnly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadOnly, setRequired, toString
-
-
-
-
Constructor Detail
-
PDCheckBox
public PDCheckBox(PDAcroForm acroForm)
- Parameters:
acroForm
- The acroform.- See Also:
PDField(PDAcroForm)
-
PDCheckBox
PDCheckBox(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
Constructor.- Parameters:
acroForm
- The form that this field is part of.field
- the PDF object to represent as a field.parent
- the parent node of the node
-
-
Method Detail
-
isChecked
public boolean isChecked()
This will tell if this radio button is currently checked or not. This is equivalent to callingPDButton.getValue()
.- Returns:
- true If this field is checked.
-
check
public void check() throws java.io.IOException
Checks the check box.- Throws:
java.io.IOException
- if the appearance couldn't be generated.
-
unCheck
public void unCheck() throws java.io.IOException
Unchecks the check box.- Throws:
java.io.IOException
- if the appearance couldn't be generated.
-
getOnValue
public java.lang.String getOnValue()
Get the value which sets the check box to the On state.The On value should be 'Yes' but other values are possible so we need to look for that. On the other hand the Off value shall always be 'Off'. If not set or not part of the normal appearance keys 'Off' is the default
- Returns:
- the value setting the check box to the On state. If an empty string is returned there is no appearance definition.
-
-