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 Details

    • FieldsHightlightColor

      public static Color FieldsHightlightColor
    • READONLY_ID

      public static final int READONLY_ID
      1 form flag indexes for the field flags
      See Also:
    • REQUIRED_ID

      public static final int REQUIRED_ID
      2 form flag indexes for the field flags
      See Also:
    • NOEXPORT_ID

      public static final int NOEXPORT_ID
      3 form flag indexes for the field flags
      See Also:
    • MULTILINE_ID

      public static final int MULTILINE_ID
      13 form flag indexes for the field flags
      See Also:
    • PASSWORD_ID

      public static final int PASSWORD_ID
      14 form flag indexes for the field flags
      See Also:
    • NOTOGGLETOOFF_ID

      public static final int NOTOGGLETOOFF_ID
      15 form flag indexes for the field flags
      See Also:
    • RADIO_ID

      public static final int RADIO_ID
      16 form flag indexes for the field flags
      See Also:
    • PUSHBUTTON_ID

      public static final int PUSHBUTTON_ID
      17 form flag indexes for the field flags
      See Also:
    • COMBO_ID

      public static final int COMBO_ID
      18 form flag indexes for the field flags
      See Also:
    • EDIT_ID

      public static final int EDIT_ID
      19 form flag indexes for the field flags
      See Also:
    • MULTISELECT_ID

      public static final int MULTISELECT_ID
      22 form flag indexes for the field flags
      See Also:
    • DONOTSCROLL_ID

      public static final int DONOTSCROLL_ID
      24 form flag indexes for the field flags
      See Also:
    • RICHTEXT_AND_RADIOINUNISON_ID

      public static final int RICHTEXT_AND_RADIOINUNISON_ID
      26 form flag indexes for the field flags
      See Also:
  • 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
    • setActionFlag

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

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

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

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

      public int getInt(int id)
      Overrides:
      getInt 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
    • getNameAsConstant

      public int getNameAsConstant(int id)
      Overrides:
      getNameAsConstant 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
    • getTextStreamValueAsByte

      public byte[] getTextStreamValueAsByte(int id)
      Overrides:
      getTextStreamValueAsByte 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
    • setMixedArray

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

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

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

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

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

      public void setName(int id, byte[] value)
      Overrides:
      setName 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)
    • setTextStreamValue

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

      public void setTextStreamValue(int id, String value)
    • getName

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

      public String getTextStreamValue(int id)
      Overrides:
      getTextStreamValue in class org.jpedal.objects.raw.PdfObject
    • 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
    • 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
    • setSelection

      public void setSelection(Object[] selectedValues, String curValue, int[] indices, int index)
      sets the selected item only applicable to the choices fields
      Parameters:
      selectedValues - an array of objects containing the selected values
      curValue - the current value
      indices - an array of indices
      index - the index of the selected object
    • 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 - dont display or print [2] 3 = print - print if set, dont if not [3] 4 = nozoom [4] 5= norotate [5] 6= noview [6] 7 = read only (ignored by wiget) [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
    • getValuesMap

      public Map<String,String> getValuesMap(boolean keyFirst)
      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
    • getItemsList

      public String[] getItemsList()
      Returns:
      the available items for this list or combo
    • getSelectedItem

      public String getSelectedItem()
      Returns:
      the selected Item for this field
    • getSelectionIndices

      public int[] getSelectionIndices()
      Returns:
      the top index, or item that is visible in the combobox or list first.
    • getTextString

      public String getTextString()
      Returns:
      the text string for this field - if no value set but a default (DV value) set, return that.
    • 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
    • getValue

      public String getValue()
      returns the current value for this field, if text field the text string, if choice field the selected item if button field the normal caption
      Returns:
      current value of this field
    • 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()
    • updateValue

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

      public boolean isSelected()
    • setSelected

      public void setSelected(boolean setSelected)
    • getSelectedIndex

      public int getSelectedIndex()
    • 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
    • getFormValue

      public Object getFormValue()
    • setFormValue

      public void setFormValue(Object value)
    • 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