Class FormObject

java.lang.Object
org.jpedal.objects.raw.PdfObject
org.jpedal.objects.raw.FormObject

public class FormObject extends org.jpedal.objects.raw.PdfObject
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    If set, the field is a combo box; if clear, the field is a list box.
    static final int
    If set, the field shall not scroll (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle.
    static final int
    If set, text entered in the field shall not be spell-checked.
    static final int
    If set, the combo box shall include an editable text box as well as a drop-down list; if clear, it shall include only a drop-down list.
    static Color
     
    static final int
    If set, the field may contain multiple lines of text; if clear, the field’s text shall be restricted to a single line.
    static final int
    If set, more than one of the field’s option items may be selected simultaneously; if clear, at most one item shall be selected.
    static final int
    If set, the field shall not be exported by a submit-form action
    static final int
    (Radio buttons only) If set, exactly one radio button shall be selected at all times; selecting the currently selected button has no effect.
    static final int
    If set, the field is intended for entering a secure password that should not be echoed visibly to the screen.
    static final int
     
    static final int
    If set, the field is a push-button that does not retain a permanent value.
    static final int
    If set, the field is a set of radio buttons; if clear, the field is a check box.
    static final int
    If set, an interactive PDF processor shall not allow a user to change the value of the field.
    static final int
    If set, the field shall have a value at the time it is exported by a submit-form action .
    static final int
    RichText:
    static final int
    If set, the field’s option items shall be sorted alphabetically.

    Fields inherited from class org.jpedal.objects.raw.PdfObject

    DECODED, stream, UNDECODED_DIRECT, UNDECODED_REF
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    FormObject(int type)
     
    FormObject(int ref, int gen)
     
     
    FormObject(String ref, boolean flag)
     
    FormObject(String ref, int parentType)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    String[][]
    choiceIndicesToOptions(int[] indices)
    Convert a list of indices into a list of the options they represent
    int[]
    choiceOptionsToIndices(String[] options, boolean optionsAreDisplay)
    Convert a list of options into a list of indices
    int
    choiceOptionToIndex(String option, boolean optionIsDisplay)
    Get the index of the given option
    void
    overwrites all the values on this form with any values from the parent
    boolean
     
    org.jpedal.objects.raw.PdfObject
     
    flipChoiceOption(String[] values, boolean valuesAreDisplay)
    Flip the choice option
    flipChoiceOption(String value, boolean valueIsDisplay)
    Flip a choice option
    static Color
    generateColor(float[] toks)
    takes a value and turns it into the color it represents, e.g. (0.5) represents gray (127,127,127) grey = array length 1, with one value rgb = array length 3, in the order of red,green,blue cmyk = array length 4, in the reverse order, (ie. k, y, m, c)
    int
    get status found during decode
    int
     
    boolean
    getBoolean(int id)
     
    This method should be called only in tabbing functionality
    return the bounding rectangle for this object
    boolean[]
     
    String[][]
    Get the available choice options for this choice field
    float
     
    Get the first element of the default fieldValues
    for when the field only expects a single value
    Get the default Field Values
    For when the field can have multiple values
    org.jpedal.objects.raw.PdfObject
    getDictionary(int id)
     
    Get the export values of the choice field
    boolean[]
    returns the flags array (Ff in PDF) (indexs are the number listed)
    * all
    1=readonly - if set there is no interaction
    2=required - if set the field must have a value when submit-form-action occures
    3=noexport - if set the field must not be exported by a submit-form-action

    Choice fields
    18=combo - set its a combobox, else a list box
    19=edit - defines a comboBox to be editable
    20=sort - defines list to be sorted alphabetically
    22=multiselect - if set more than one items can be selected, else only one
    23=donotspellcheck - (only used on editable combobox) don't spell check
    27=commitOnselchange - if set commit the action when selection changed, else commit when user exits field

    text fields
    13=multiline - uses multipul lines else uses a single line
    14=password - a password is intended
    21=fileselect -text in field represents a file pathname to be submitted
    23=donotspellcheck - don't spell check
    24=donotscroll - once the field is full don't enter anymore text.
    Get the first element of the fieldValues
    For when the field only expects a single value
    Get the fieldValues
    For when the field can have multiple values
    float[][]
     
    float[]
    getFloatArray(int id)
     
    float
     
     
    float
    Method to get the font size to be used in the form component This is currently only implemented for text pop-up forms
    int
    look at FormFactory.LIST etc for full list of types
    Get the current value of the form field
     
     
    int
    getInt(int id)
     
    int[]
    getIntArray(int id)
     
    Get the display values of the choice field
    byte[][]
    getKeyArray(int id)
     
    used by JS to reset
     
    int[]
    Method returns matte border details of Form (not all surrounding element)
    org.jpedal.objects.raw.PdfArrayIterator
    getMixedArray(int id)
     
    getName(int id)
     
    int
     
     
     
     
    org.jpedal.objects.raw.PdfObject
     
    gets the parent for this field
    byte[][]
     
    int
    Get the index of the selected item for this choice field
    Get the selected item for this choice field
    Get the selected items for this choice field
    int[]
    Get the indices of the selected items for this choice field
    byte[][]
     
     
     
    int
     
    int
     
     
    byte[]
     
     
    returns the current value for this field, if text field the text string, if choice field the selected item (Does not account for multi choice fields) if button field the normal caption
    getValuesMap(boolean keyFirst)
    Deprecated.
    This returns a map, which due to the potential of duplicate keys, may lose values, you should instead use getChoiceOptions() for an array of pairs
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    Check whether element exists within HTML page content and should not be rasterized on background (but still rasterize on thumbnail)
    boolean
     
    boolean
    Get whether this radio button or checkbox is checked
    boolean
     
    void
    reset this form field to its default value If the field doesn't have a default value, then it will be emptied
    void
    setActionFlag(int popup)
    used internally to set status while parsing - should not be called
    void
    setAddedToHTML(boolean isAddedToHTML)
    Flag that element exists within HTML page content and should not be rasterized on background (but still rasterize on thumbnail)
    void
    setAppreancesUsed(boolean used)
     
    void
    setBoolean(int id, boolean value)
     
    void
    setCurrentScaling(float scale)
    Set the scaling for the formObject this is only used for the locations of forms that can move such as Text Popups
    void
    setDictionary(int id, org.jpedal.objects.raw.PdfObject value)
     
    void
    setFloat2DArray(int id, float[][] values)
     
    void
    setFloatArray(int id, float[] value)
     
    void
    setFloatNumber(int id, float value)
     
    void
    set the text font for this form
    void
    setFormType(int widgetType)
     
    void
    Set the value of the form field
    void
    setGUIComponent(Object guiComp, int guiType)
     
    void
    setHTMLElementId(String htmlElementId)
     
    void
    setIntArray(int id, int[] value)
     
    void
    setIntNumber(int id, int value)
     
    void
    setKeyArray(int id, byte[][] value)
     
    void
    used by JS to reset
    void
    setMixedArray(int id, byte[][] value)
     
    void
    setName(int id, byte[] value)
     
    void
    set the state which is defined as the On state for this form
    usually different for each child so that the selected child can be found by the state
    void
    setObjectArray(int id, Object[] objectValues)
     
    void
    setPageRotation(int rotation)
     
    void
    setParent(String parent)
    sets the parent for this field
    void
    setParent(String parent, FormObject parentObj, boolean copyValuesFromParent)
    sets the parent string for this field and stores the parent PDFObject passed in to be accessed locally and from getParent() BEWARE :- this method will copy all relevent values from the parent is copyValuesFromParent is true
    void
    setParentPdfObj(org.jpedal.objects.raw.PdfObject parent)
     
    void
    setRawKids(byte[][] kidsInParent)
     
    void
    setSelected(boolean setSelected)
    Set whether this radio button or checkbox is checked
    void
    setSelection(Object[] selectedValues, String curValue, int[] indices, int index)
    Deprecated.
    As curValue and index are ignored, setSelection(String[], int[]), or setSelection(String, int) is preferred
    void
    setSelection(String[] selectedValues, int[] indices)
    Set the currently selected items of the choice field
    void
    setSelection(String[] selectedValues, int[] indices, boolean sync)
    Set the currently selected items of the choice field
    void
    setSelection(String selectedValue, int index)
    Set the currently selected item of the choice field
    void
    setStringArray(int id, byte[][] keyValues)
     
    void
    setTextColor(float[] color)
    sets the text color for this form
    void
    set the text font for this form
    void
    setTextSize(int size)
    sets the text size for this form
    void
    setTextStreamValue(int id, byte[] value)
     
    void
    setTextString(String textString)
    Set the value of the text string, syncing the GUI if present
    void
    setVisible(boolean isVisible)
     
    void
    updateValue(Object value, boolean isSelected, boolean sync)
    allow us to update value (and sync to GUI if exists)

    Methods inherited from class org.jpedal.objects.raw.PdfObject

    getArrayRef, getBooleanArray, getByteArray, getCachedStreamFile, getCacheName, getClip, getConvertedData, getDecodedStream, getDoubleArray, getGeneralStringValue, getGeneralType, getID, getKeyPairsIterator, getLong, getObjectRefAsString, getObjectRefGeneration, getObjectRefID, getObjectType, getPageNumber, getParentID, getPassword, getPDFkeyInt, getRawObjectType, getStatus, getStringKey, getStringValue, getUnresolvedData, hasStream, ignoreRecursion, ignoreRecursion, ignoreStream, ignoreStream, isCached, isCompressedStream, isDataExternal, isDataExternal, isFullyResolved, isInCompressedStream, moveCacheValues, setArrayRef, setBooleanArray, setCache, setClip, setCompressedStream, setConstant, setConstant, setConvertedData, setDecodedStream, setDictionaryPairs, setDoubleArray, setFullyResolved, setGeneralStringValue, setID, setInCompressedStream, setLong, setPageNumber, setRef, setStatus, setStream, setStreamMayBeCorrupt, setStringKey, setTextStreamValue, setUnresolvedData, streamMayBeCorrupt, validateRectangle

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FieldsHightlightColor

      public static Color FieldsHightlightColor
    • READONLY_ID

      public static final int READONLY_ID
      If set, an interactive PDF processor shall not allow a user to change the value of the field. Additionally, any associated widget annotations should not interact with the user; that is, they should not respond to mouse clicks nor change their appearance in response to mouse motions.

      NOTE: This flag is useful for fields whose values are computed or imported from a database.

      1 form flag indexes for the field flags

      See Also:
    • REQUIRED_ID

      public static final int REQUIRED_ID
      If set, the field shall have a value at the time it is exported by a submit-form action .

      2 form flag indexes for the field flags

      See Also:
    • NOEXPORT_ID

      public static final int NOEXPORT_ID
      If set, the field shall not be exported by a submit-form action

      3 form flag indexes for the field flags

      See Also:
    • MULTILINE_ID

      public static final int MULTILINE_ID
      If set, the field may contain multiple lines of text; if clear, the field’s text shall be restricted to a single line.

      13 form flag indexes for the field flags

      See Also:
    • PASSWORD_ID

      public static final int PASSWORD_ID
      If set, the field is intended for entering a secure password that should not be echoed visibly to the screen. Characters typed from the keyboard shall instead be echoed in some unreadable form, such as asterisks or bullet characters.

      NOTE To protect password confidentiality, it is imperative that PDF processors never store the value of the text field in the PDF file if this flag is set.

      14 form flag indexes for the field flags

      See Also:
    • NOTOGGLETOOFF_ID

      public static final int NOTOGGLETOOFF_ID
      (Radio buttons only) If set, exactly one radio button shall be selected at all times; selecting the currently selected button has no effect. If clear, clicking the selected button deselects it, leaving no button selected.

      15 form flag indexes for the field flags

      See Also:
    • RADIO_ID

      public static final int RADIO_ID
      If set, the field is a set of radio buttons; if clear, the field is a check box. This flag may be set only if the Pushbutton flag is clear.

      16 form flag indexes for the field flags

      See Also:
    • PUSHBUTTON_ID

      public static final int PUSHBUTTON_ID
      If set, the field is a push-button that does not retain a permanent value.

      17 form flag indexes for the field flags

      See Also:
    • COMBO_ID

      public static final int COMBO_ID
      If set, the field is a combo box; if clear, the field is a list box.

      18 form flag indexes for the field flags

      See Also:
    • EDIT_ID

      public static final int EDIT_ID
      If set, the combo box shall include an editable text box as well as a drop-down list; if clear, it shall include only a drop-down list. This flag shall be used only if the Combo flag is set

      19 form flag indexes for the field flags

      See Also:
    • SORT_ID

      public static final int SORT_ID
      If set, the field’s option items shall be sorted alphabetically. This flag is intended for use by PDF writers, not by PDF readers. PDF readers shall display the options in the order in which they occur in the Opt array.

      20 form flag indexes for the field flags

      See Also:
    • MULTISELECT_ID

      public static final int MULTISELECT_ID
      If set, more than one of the field’s option items may be selected simultaneously; if clear, at most one item shall be selected.

      22 form flag indexes for the field flags

      Since:
      PDF 1.4
      See Also:
    • DONOTSPELLCHECK_ID

      public static final int DONOTSPELLCHECK_ID
      If set, text entered in the field shall not be spell-checked.

      Specifically for combo boxes: This flag shall not be used unless the Combo and Edit flags are both set.

      23 form flag indexes for the field flags

      Since:
      PDF 1.4
      See Also:
    • DONOTSCROLL_ID

      public static final int DONOTSCROLL_ID
      If set, the field shall not scroll (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text shall be accepted for interactive form filling; for non-interactive form filling, the filler should take care not to add more character than will visibly fit in the defined area.

      24 form flag indexes for the field flags

      Since:
      PDF 1.4
      See Also:
    • RICHTEXT_AND_RADIOINUNISON_ID

      public static final int RICHTEXT_AND_RADIOINUNISON_ID
      RichText:

      If set, the value of this field shall be a rich text string. If the field has a value, the RV entry of the field dictionary shall specify the rich text string.

      Radios In Unison:

      If set, a group of radio buttons within a radio button field that use the same value for the on state will turn on and off in unison; that is if one is checked, they are all checked. If clear, the buttons are mutually exclusive (the same behaviour as HTML radio buttons).

      26 form flag indexes for the field flags

      Since:
      PDF 1.5
      See Also:
      • "Adobe XML Architecture, XML Forms Architecture (XFA) Specification, version 3.3"
      • "Table 228 — Additional entries common to all fields containing variable text"
      • Constant Field Values
  • Constructor Details

    • FormObject

      public FormObject(String ref)
    • FormObject

      public FormObject(String ref, boolean flag)
    • FormObject

      public FormObject(int ref, int gen)
    • FormObject

      public FormObject(int type)
    • FormObject

      public FormObject()
    • FormObject

      public FormObject(String ref, int parentType)
  • Method Details

    • setHTMLElementId

      public void setHTMLElementId(String htmlElementId)
    • getHTMLElementId

      public String getHTMLElementId()
    • getBoolean

      public boolean getBoolean(int id)
      Overrides:
      getBoolean in class org.jpedal.objects.raw.PdfObject
    • setBoolean

      public void setBoolean(int id, boolean value)
      Overrides:
      setBoolean in class org.jpedal.objects.raw.PdfObject
    • getActionFlag

      public int getActionFlag()
      get status found during decode
      Returns:
      the value of the popup flag
    • setActionFlag

      public void setActionFlag(int popup)
      used internally to set status while parsing - should not be called
      Parameters:
      popup - the popup flag value
    • getDictionary

      public org.jpedal.objects.raw.PdfObject getDictionary(int id)
      Overrides:
      getDictionary in class org.jpedal.objects.raw.PdfObject
    • setDictionary

      public void setDictionary(int id, org.jpedal.objects.raw.PdfObject value)
      Overrides:
      setDictionary in class org.jpedal.objects.raw.PdfObject
    • getInt

      public int getInt(int id)
      Overrides:
      getInt in class org.jpedal.objects.raw.PdfObject
    • setIntNumber

      public void setIntNumber(int id, int value)
      Overrides:
      setIntNumber in class org.jpedal.objects.raw.PdfObject
    • getFloatNumber

      public float getFloatNumber(int id)
      Overrides:
      getFloatNumber in class org.jpedal.objects.raw.PdfObject
    • setFloatNumber

      public void setFloatNumber(int id, float value)
      Overrides:
      setFloatNumber in class org.jpedal.objects.raw.PdfObject
    • getNameAsConstant

      public int getNameAsConstant(int id)
      Overrides:
      getNameAsConstant in class org.jpedal.objects.raw.PdfObject
    • getName

      public String getName(int id)
      Overrides:
      getName in class org.jpedal.objects.raw.PdfObject
    • setName

      public void setName(int id, byte[] value)
      Overrides:
      setName in class org.jpedal.objects.raw.PdfObject
    • getTextStreamValue

      public String getTextStreamValue(int id)
      Overrides:
      getTextStreamValue in class org.jpedal.objects.raw.PdfObject
    • getTextStreamValueAsByte

      public byte[] getTextStreamValueAsByte(int id)
      Overrides:
      getTextStreamValueAsByte in class org.jpedal.objects.raw.PdfObject
    • setTextStreamValue

      public void setTextStreamValue(int id, byte[] value)
      Overrides:
      setTextStreamValue in class org.jpedal.objects.raw.PdfObject
    • getMixedArray

      public org.jpedal.objects.raw.PdfArrayIterator getMixedArray(int id)
      Overrides:
      getMixedArray in class org.jpedal.objects.raw.PdfObject
    • setMixedArray

      public void setMixedArray(int id, byte[][] value)
      Overrides:
      setMixedArray in class org.jpedal.objects.raw.PdfObject
    • getIntArray

      public int[] getIntArray(int id)
      Overrides:
      getIntArray in class org.jpedal.objects.raw.PdfObject
    • setIntArray

      public void setIntArray(int id, int[] value)
      Overrides:
      setIntArray in class org.jpedal.objects.raw.PdfObject
    • getFloatArray

      public float[] getFloatArray(int id)
      Overrides:
      getFloatArray in class org.jpedal.objects.raw.PdfObject
    • setFloatArray

      public void setFloatArray(int id, float[] value)
      Overrides:
      setFloatArray in class org.jpedal.objects.raw.PdfObject
    • setObjectArray

      public void setObjectArray(int id, Object[] objectValues)
      Overrides:
      setObjectArray in class org.jpedal.objects.raw.PdfObject
    • getObjectArray

      public Object[] getObjectArray(int id)
      Overrides:
      getObjectArray in class org.jpedal.objects.raw.PdfObject
    • setFloat2DArray

      public void setFloat2DArray(int id, float[][] values)
    • getFloat2DArray

      public float[][] getFloat2DArray(int id)
    • getKeyArray

      public byte[][] getKeyArray(int id)
      Overrides:
      getKeyArray in class org.jpedal.objects.raw.PdfObject
    • setKeyArray

      public void setKeyArray(int id, byte[][] value)
      Overrides:
      setKeyArray in class org.jpedal.objects.raw.PdfObject
    • setStringArray

      public void setStringArray(int id, byte[][] keyValues)
      Overrides:
      setStringArray in class org.jpedal.objects.raw.PdfObject
    • getStringArray

      public byte[][] getStringArray(int id)
      Overrides:
      getStringArray in class org.jpedal.objects.raw.PdfObject
    • getFieldValue

      public String getFieldValue()
      Get the first element of the fieldValues
      For when the field only expects a single value
      Returns:
      The first element of field values, or null if field values is null or empty
      See Also:
    • getFieldValues

      public String[] getFieldValues()
      Get the fieldValues
      For when the field can have multiple values
      Returns:
      The fieldValues
      See Also:
    • getDefaultFieldValue

      public String getDefaultFieldValue()
      Get the first element of the default fieldValues
      for when the field only expects a single value
      Returns:
      The first element of DV, or null if DV is null or empty
    • getDefaultFieldValues

      public String[] getDefaultFieldValues()
      Get the default Field Values
      For when the field can have multiple values
      Returns:
      The default field values
      See Also:
    • setSelection

      @Deprecated public void setSelection(Object[] selectedValues, String curValue, int[] indices, int index)
      Deprecated.
      As curValue and index are ignored, setSelection(String[], int[]), or setSelection(String, int) is preferred
      Sets the selected items
      Only applicable to choice fields

      Please note that curValue and index are unused as they can be expressed in the selectedValues and indices.

      Parameters:
      selectedValues - an array of objects containing the selected values
      curValue - unused
      indices - an array of indices
      index - unused
      See Also:
    • setSelection

      public void setSelection(String[] selectedValues, int[] indices, boolean sync)
      Set the currently selected items of the choice field
      Parameters:
      selectedValues - An array of strings containing the selected values
      indices - An array of indices that reference the optValues. Where the indexes represent the users selection of the options
      sync - Sync this change in selection to the guiComp, if available
      See Also:
      Implementation Note:
      This is version of the method, with a sync variable, is required due to the way that updating a List field works: a list field, when setting its selected indices, will first clear the selection. This clear triggers the state change listener, which calls this method, which calls updateChoiceFieldIndex(), which sets the selected indices and becomes an infinite loop. The inclusion of the sync parameter allows the listener to deny a gui sync, preventing the loop.
    • setSelection

      public void setSelection(String[] selectedValues, int[] indices)
      Set the currently selected items of the choice field
      Parameters:
      selectedValues - An array of strings containing the selected values
      indices - An array of indices that reference the optValues. Where the indexes represent the users selection of the options
      See Also:
    • setSelection

      public void setSelection(String selectedValue, int index)
      Set the currently selected item of the choice field
      Parameters:
      selectedValue - The value of the selected item
      index - The index, referencing an element in the optValues}, of the selected item.
      See Also:
    • getSelectedItem

      public String getSelectedItem()
      Get the selected item for this choice field

      Note that some choice fields can have multiple values simultaneously, for those fields this method will only return the first selected item, you should instead use getSelectedItems()

      Returns:
      the selected Item for this field
      See Also:
    • getSelectedItems

      public String[] getSelectedItems()
      Get the selected items for this choice field

      Note that most fields can have only a single value selected at a time, for those fields this method will return a single item array. You may prefer to use getSelectedItem().

      Returns:
      the selected items for this field
      See Also:
    • getSelectedIndex

      public int getSelectedIndex()
      Get the index of the selected item for this choice field

      The indices refer to items in the opt array.

      Note that some choice fields can have multiple values simultaneously, for those fields this method will only return the first selected index, you should instead use getSelectionIndices().

      Returns:
      The index of the selected item
      See Also:
    • getSelectionIndices

      public int[] getSelectionIndices()
      Get the indices of the selected items for this choice field

      The indices refer to items in the opt array.

      Note that most choice fields can have only a single value selected at a time, for those fields this method will return a single item array. You may prefer to use getSelectedIndex().

      Returns:
      The indices of the selected items
      See Also:
    • getTextString

      public String getTextString()
      Returns:
      The text string for this field - if no value set but a default (DV value) set, then return that, otherwise return an empty string.
    • setTextString

      public void setTextString(String textString)
      Set the value of the text string, syncing the GUI if present
      Parameters:
      textString - The new text string
    • isSelected

      public boolean isSelected()
      Get whether this radio button or checkbox is checked

      This only works for radio buttons and checkboxes, and will produce weird behaviour on other fields

      Returns:
      Whether this radio button or checkbox is checked
    • setSelected

      public void setSelected(boolean setSelected)
      Set whether this radio button or checkbox is checked
      Parameters:
      setSelected - Whether this radio button or checkbox is checked
    • resetToDefault

      public void resetToDefault()
      reset this form field to its default value If the field doesn't have a default value, then it will be emptied
    • getValue

      public String getValue()
      returns the current value for this field, if text field the text string, if choice field the selected item (Does not account for multi choice fields) if button field the normal caption

      Use of this field is discouraged, where getting the value through the fields specific accessor is preferred

      Returns:
      current value of this field
      See Also:
    • updateValue

      public void updateValue(Object value, boolean isSelected, boolean sync)
      allow us to update value (and sync to GUI if exists)
      Parameters:
      value - the new value to update with
      isSelected - true if the object is selected
      sync - true if we want to sync
    • getFormValue

      public Object getFormValue()
      Get the current value of the form field

      Use of this field is discouraged, where getting the value through the fields specific accessor is preferred

      Returns:
      The current form field
    • setFormValue

      public void setFormValue(Object value)
      Set the value of the form field

      Use of this field is discouraged, where setting the value through the fields specific accessor is preferred

      Parameters:
      value - The new value of the field
    • getItemsList

      public String[] getItemsList()
      Get the display values of the choice field
      Returns:
      the available items for this choice field
      See Also:
    • getExportList

      public String[] getExportList()
      Get the export values of the choice field
      Returns:
      the available export items for this choice field
      See Also:
    • getChoiceOptions

      public String[][] getChoiceOptions()
      Get the available choice options for this choice field

      The returned value will be an array of options, where each option will be represented by a 2 component array. The first component will be the export value, and the second component will be the display value.

      If the opt array is missing, then this returns an empty array.

      Returns:
      The available options for the choice field, or an empty array
      See Also:
    • choiceIndicesToOptions

      public String[][] choiceIndicesToOptions(int[] indices)
      Convert a list of indices into a list of the options they represent
      Parameters:
      indices - A list of indices representing options in the opt values
      Returns:
      A list of options([Export value, display value])
    • choiceOptionsToIndices

      public int[] choiceOptionsToIndices(String[] options, boolean optionsAreDisplay)
      Convert a list of options into a list of indices
      Parameters:
      options - The options of the opt values to look up These can be export values, or display values, as determined by the optionsAreDisplay parameter
      optionsAreDisplay - Whether the values in options represent export values or display values
      Returns:
      A list of indices
    • choiceOptionToIndex

      public int choiceOptionToIndex(String option, boolean optionIsDisplay)
      Get the index of the given option
      Parameters:
      option - The option from the opt values to get the index of This can be an export value, or a display value, as determined by the optionIsDisplay parameter
      optionIsDisplay - Whether the option represents an export value or a display value
      Returns:
      An index
    • flipChoiceOption

      public String[] flipChoiceOption(String[] values, boolean valuesAreDisplay)
      Flip the choice option

      Gets the display value from an export value, or an export value from a display value

      Parameters:
      values - The value to flip
      valuesAreDisplay - When true, the values being passed are the display values
      When false, the values being passed are the export values
      Returns:
      The choice options flipped
    • flipChoiceOption

      public String flipChoiceOption(String value, boolean valueIsDisplay)
      Flip a choice option

      Gets the display value from an export value, or an export value from a display value

      Parameters:
      value - The value to flip
      valueIsDisplay - When true, the value being passed is the display value
      When false, the value being passed is the export value
      Returns:
      The choice option flipped, or the value if there isn't an entry for the value in the opt array
    • getValuesMap

      @Deprecated public Map<String,String> getValuesMap(boolean keyFirst)
      Deprecated.
      This returns a map, which due to the potential of duplicate keys, may lose values, you should instead use getChoiceOptions() for an array of pairs
      Parameters:
      keyFirst - true if we want the keys first
      Returns:
      the values map for this field, map that references the display value from the export values
      See Also:
    • decompressStreamWhenRead

      public boolean decompressStreamWhenRead()
      Overrides:
      decompressStreamWhenRead in class org.jpedal.objects.raw.PdfObject
    • generateColor

      public static Color generateColor(float[] toks)
      takes a value and turns it into the color it represents, e.g. (0.5) represents gray (127,127,127)
      • grey = array length 1, with one value
      • rgb = array length 3, in the order of red,green,blue
      • cmyk = array length 4, in the reverse order, (ie. k, y, m, c)
      Parameters:
      toks - an array of tokens
      Returns:
      an object containing details of the color
    • isXFAObject

      public boolean isXFAObject()
      Returns:
      true if this formObject represents an XFAObject
    • duplicate

      public org.jpedal.objects.raw.PdfObject duplicate()
    • copyInheritedValuesFromParent

      public void copyInheritedValuesFromParent(FormObject parentObj)
      overwrites all the values on this form with any values from the parent
      Parameters:
      parentObj - the parent form data object containing the details of the form object
    • getAlignment

      public int getAlignment()
      Returns:
      the alignment (Q)
    • setTextColor

      public void setTextColor(float[] color)
      sets the text color for this form
      Parameters:
      color - the text color for this form
    • setFontName

      public void setFontName(String font)
      set the text font for this form
      Parameters:
      font - the name of the font
    • setTextFont

      public void setTextFont(Font font)
      set the text font for this form
      Parameters:
      font - the name of the text font
    • setTextSize

      public void setTextSize(int size)
      sets the text size for this form
      Parameters:
      size - text size
    • setParent

      public void setParent(String parent)
      sets the parent for this field
      Parameters:
      parent - the parent of the field
    • setParent

      public void setParent(String parent, FormObject parentObj, boolean copyValuesFromParent)
      sets the parent string for this field and stores the parent PDFObject passed in to be accessed locally and from getParent() BEWARE :- this method will copy all relevent values from the parent is copyValuesFromParent is true
      Parameters:
      parent - the parent of the field
      parentObj - a data object containing details of the parent form object
      copyValuesFromParent - true if we are copying values from parent
    • getParentPdfObj

      public org.jpedal.objects.raw.PdfObject getParentPdfObj()
    • setParentPdfObj

      public void setParentPdfObj(org.jpedal.objects.raw.PdfObject parent)
    • getParentRef

      public String getParentRef()
      gets the parent for this field
      Returns:
      the parent object reference
    • getBounding2DRectangleForTabbing

      public Rectangle2D getBounding2DRectangleForTabbing()
      This method should be called only in tabbing functionality
      Returns:
      the bounded 2d rectangle object
    • getBoundingRectangle

      public Rectangle getBoundingRectangle()
      return the bounding rectangle for this object
      Returns:
      the bounding rectangle of the object
    • getFieldFlags

      public boolean[] getFieldFlags()
      returns the flags array (Ff in PDF) (indexs are the number listed)
      * all
      1=readonly - if set there is no interaction
      2=required - if set the field must have a value when submit-form-action occures
      3=noexport - if set the field must not be exported by a submit-form-action

      Choice fields
      18=combo - set its a combobox, else a list box
      19=edit - defines a comboBox to be editable
      20=sort - defines list to be sorted alphabetically
      22=multiselect - if set more than one items can be selected, else only one
      23=donotspellcheck - (only used on editable combobox) don't spell check
      27=commitOnselchange - if set commit the action when selection changed, else commit when user exits field

      text fields
      13=multiline - uses multipul lines else uses a single line
      14=password - a password is intended
      21=fileselect -text in field represents a file pathname to be submitted
      23=donotspellcheck - don't spell check
      24=donotscroll - once the field is full don't enter anymore text.
      25=comb - (only if maxlen is present, (multiline, password and fileselect are CLEAR)), the text is justified across the field to MaxLen
      26=richtext - use richtext format specified by RV entry in field dictionary

      button fields
      15=notoggletooff - (use in radiobuttons only) if set one button must always be selected
      16=radio - if set is a set of radio buttons
      17=pushbutton - if set its a push button, if neither 16 nor 17 its a check box
      26=radiosinunison - if set all radio buttons with the same on state are turned on and off in unison (same behaviour as html browsers)
      Returns:
      an array of the flags
    • setNormalOnState

      public void setNormalOnState(String state)
      set the state which is defined as the On state for this form
      usually different for each child so that the selected child can be found by the state
      Parameters:
      state - the normal on state
    • isAppearanceUsed

      public boolean isAppearanceUsed()
      Returns:
      whether or not appearances are used in this field
    • setAppreancesUsed

      public void setAppreancesUsed(boolean used)
    • hasDownImage

      public boolean hasDownImage()
      Returns:
      true if has one or more down images set
    • getCharacteristics

      public boolean[] getCharacteristics()
      Returns:
      the characteristics for this field.

      bit 1 is index 0 in []
      [0] 1 = invisible
      [1] 2 = hidden - don't display or print
      [2] 3 = print - print if set, don't if not
      [3] 4 = nozoom
      [4] 5= norotate
      [5] 6= noview
      [6] 7 = read only (ignored by widget)
      [7] 8 = locked [8] 9 = togglenoview as on pdf 1.7 this became 10 bits long
      [9] 10 = LockedContents

    • getTextSize

      public int getTextSize()
      Returns:
      the default text size for this field
    • getTextPosition

      public int getTextPosition()
      Returns:
      the position of the view of the text in this field

      positioning of text relative to icon - (integer)
      0=caption only 1=icon only
      2=caption below icon
      3=caption above icon
      4=caption on right of icon
      5=caption on left of icon
      6=caption overlaid ontop of icon

    • getNormalOnState

      public String getNormalOnState()
      Returns:
      the normal on state for this field
    • hasNoDownIcon

      public boolean hasNoDownIcon()
      Returns:
      if this field has not got a down icon
    • hasOffsetDownIcon

      public boolean hasOffsetDownIcon()
      Returns:
      whether this field has a down icon as an offset of the normal icon
    • hasInvertDownIcon

      public boolean hasInvertDownIcon()
      Returns:
      whether this field has a down icon as an inverted image of the normal icon
    • getTextFont

      public Font getTextFont()
      Returns:
      the text font for this field
    • getFontName

      public String getFontName()
    • getTextColor

      public Color getTextColor()
      Returns:
      the text color for this field
    • getLayerName

      public String getLayerName()
      Returns:
      the name of the layer
    • setCurrentScaling

      public void setCurrentScaling(float scale)
      Set the scaling for the formObject this is only used for the locations of forms that can move such as Text Popups
      Parameters:
      scale - : Current scaling to be used
    • getCurrentScaling

      public float getCurrentScaling()
    • setFormType

      public void setFormType(int widgetType)
    • getFormType

      public int getFormType()
      look at FormFactory.LIST etc for full list of types
      Returns:
      the form type
    • getOpaqueImage

      public static BufferedImage getOpaqueImage()
      Returns:
      an Opaque BufferedImage for use when appearance Streams are null
    • setGUIComponent

      public void setGUIComponent(Object guiComp, int guiType)
    • getGUIComponent

      public Object getGUIComponent()
    • getFontSize

      public float getFontSize()
      Method to get the font size to be used in the form component This is currently only implemented for text pop-up forms
      Returns:
      The base size to be used in the form component
    • getLastValidValue

      public String getLastValidValue()
      used by JS to reset
      Returns:
      the last valid value
    • setLastValidValue

      public void setLastValidValue(String value)
      used by JS to reset
      Parameters:
      value - the last valid value to set
    • setPageRotation

      public void setPageRotation(int rotation)
    • setVisible

      public void setVisible(boolean isVisible)
    • getMatteBorderDetails

      public int[] getMatteBorderDetails()
      Method returns matte border details of Form (not all surrounding element)
      Returns:
      details of the matte border
    • setRawKids

      public void setRawKids(byte[][] kidsInParent)
    • getRawKids

      public byte[][] getRawKids()
    • setAddedToHTML

      public void setAddedToHTML(boolean isAddedToHTML)
      Flag that element exists within HTML page content and should not be rasterized on background (but still rasterize on thumbnail)
      Parameters:
      isAddedToHTML - Whether element exists within HTML page content
    • isAddedToHTML

      public boolean isAddedToHTML()
      Check whether element exists within HTML page content and should not be rasterized on background (but still rasterize on thumbnail)
      Returns:
      Whether element exists within HTML page content