Class PDPushButton
- 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.PDPushButton
-
- All Implemented Interfaces:
COSObjectable
public class PDPushButton extends PDButton
A pushbutton is a purely interactive control that responds immediately to user input without retaining a permanent value.
-
-
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 PDPushButton(PDAcroForm acroForm)
PDPushButton(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
constructAppearances()
Constructs appearance streams and appearance dictionaries for all widget annotations.java.lang.String
getDefaultValue()
Returns the default value, if any.java.util.List<java.lang.String>
getExportValues()
This will get the (optional) export values.java.util.Set<java.lang.String>
getOnValues()
Get the values to set individual buttons within a group to the on state.java.lang.String
getValue()
Returns the selected value.java.lang.String
getValueAsString()
Returns a string representation of the "V" entry, or an empty string.void
setExportValues(java.util.List<java.lang.String> values)
This will set the export values.-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDButton
checkValue, isPushButton, isRadioButton, setDefaultValue, 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
-
PDPushButton
public PDPushButton(PDAcroForm acroForm)
- Parameters:
acroForm
- The acroform.- See Also:
PDField(PDAcroForm)
-
PDPushButton
PDPushButton(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
-
getExportValues
public java.util.List<java.lang.String> getExportValues()
Description copied from class:PDButton
This will get the (optional) export values.The export values are defined in the field dictionaries /Opt key.
The option values are used to define the export values for the field to
- hold values in non-Latin writing systems as name objects, which represent the field value, are limited to PDFDocEncoding
- allow radio buttons having the same export value to be handled independently
- Overrides:
getExportValues
in classPDButton
- Returns:
- List containing all possible export values. If there is no /Opt entry an empty list will be returned.
- See Also:
PDButton.getOnValues()
-
setExportValues
public void setExportValues(java.util.List<java.lang.String> values)
Description copied from class:PDButton
This will set the export values.- Overrides:
setExportValues
in classPDButton
- Parameters:
values
- List containing all possible export values. Supplying null or an empty list will remove the Opt entry.- See Also:
PDButton.getExportValues()
-
getValue
public java.lang.String getValue()
Description copied from class:PDButton
Returns the selected value.Off is the default value which will also be returned if the value hasn't been set at all.
-
getDefaultValue
public java.lang.String getDefaultValue()
Description copied from class:PDButton
Returns the default value, if any.- Overrides:
getDefaultValue
in classPDButton
- Returns:
- A non-null string.
-
getValueAsString
public java.lang.String getValueAsString()
Description copied from class:PDField
Returns a string representation of the "V" entry, or an empty string.- Overrides:
getValueAsString
in classPDButton
- Returns:
- The list of widget annotations.
-
getOnValues
public java.util.Set<java.lang.String> getOnValues()
Description copied from class:PDButton
Get the values to set individual buttons within a group to the on state.The On value could be an arbitrary string as long as it is within the limitations of a PDF name object. The Off value shall always be 'Off'. If not set or not part of the normal appearance keys 'Off' is the default
- Overrides:
getOnValues
in classPDButton
- Returns:
- the potential values setting the check box to the On state. If an empty Set is returned there is no appearance definition.
-
constructAppearances
void constructAppearances() throws java.io.IOException
Description copied from class:PDTerminalField
Constructs appearance streams and appearance dictionaries for all widget annotations. Subclasses should not call this method directly but viaPDTerminalField.applyChange()
.- Overrides:
constructAppearances
in classPDButton
- Throws:
java.io.IOException
- if the appearance couldn't be generated
-
-