Class PDButton

    • Method Detail

      • isPushButton

        public boolean isPushButton()
        Determines if push button bit is set.
        Returns:
        true if type of button field is a push button.
      • setPushButton

        public void setPushButton​(boolean pushbutton)
        Set the push button bit.
        Parameters:
        pushbutton - if true the button field is treated as a push button field.
      • isRadioButton

        public boolean isRadioButton()
        Determines if radio button bit is set.
        Returns:
        true if type of button field is a radio button.
      • setRadioButton

        public void setRadioButton​(boolean radiobutton)
        Set the radio button bit.
        Parameters:
        radiobutton - if true the button field is treated as a radio button field.
      • getValue

        public java.lang.String getValue()
        Returns the selected value.

        Off is the default value which will also be returned if the value hasn't been set at all.

        Returns:
        A non-null string.
      • setValue

        public void setValue​(java.lang.String value)
                      throws java.io.IOException
        Sets the selected option given its name. It also tries to update the visual appearance, unless PDAcroForm.getNeedAppearances() is true.
        Specified by:
        setValue in class PDField
        Parameters:
        value - Name of option to select
        Throws:
        java.io.IOException - if the value could not be set
        java.lang.IllegalArgumentException - if the value is not a valid option.
      • getDefaultValue

        public java.lang.String getDefaultValue()
        Returns the default value, if any.
        Returns:
        A non-null string.
      • setDefaultValue

        public void setDefaultValue​(java.lang.String value)
        Sets the default value.
        Parameters:
        value - Name of option to select
        Throws:
        java.lang.IllegalArgumentException - if the value is not a valid option.
      • getValueAsString

        public java.lang.String getValueAsString()
        Description copied from class: PDField
        Returns a string representation of the "V" entry, or an empty string.
        Specified by:
        getValueAsString in class PDField
        Returns:
        The list of widget annotations.
      • getExportValues

        public java.util.List<java.lang.String> getExportValues()
        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
        Returns:
        List containing all possible export values. If there is no /Opt entry an empty list will be returned.
        See Also:
        getOnValues()
      • setExportValues

        public void setExportValues​(java.util.List<java.lang.String> values)
        This will set the export values.
        Parameters:
        values - List containing all possible export values. Supplying null or an empty list will remove the Opt entry.
        See Also:
        getExportValues()
      • getOnValues

        public java.util.Set<java.lang.String> getOnValues()
        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

        Returns:
        the potential values setting the check box to the On state. If an empty Set is returned there is no appearance definition.