Package org.jpedal.objects.raw
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
FieldsModifier and TypeFieldDescriptionstatic final int
18 form flag indexes for the field flagsstatic final int
24 form flag indexes for the field flagsstatic final int
19 form flag indexes for the field flagsstatic Color
static final int
13 form flag indexes for the field flagsstatic final int
22 form flag indexes for the field flagsstatic final int
3 form flag indexes for the field flagsstatic final int
15 form flag indexes for the field flagsstatic final int
14 form flag indexes for the field flagsstatic final int
static final int
17 form flag indexes for the field flagsstatic final int
16 form flag indexes for the field flagsstatic final int
1 form flag indexes for the field flagsstatic final int
2 form flag indexes for the field flagsstatic final int
26 form flag indexes for the field flagsFields inherited from class org.jpedal.objects.raw.PdfObject
DECODED, stream, UNDECODED_DIRECT, UNDECODED_REF
-
Constructor Summary
ConstructorsConstructorDescriptionFormObject
(int type) FormObject
(int ref, int gen) FormObject
(String ref) FormObject
(String ref, boolean flag) FormObject
(String ref, int parentType) -
Method Summary
Modifier and TypeMethodDescriptionvoid
copyInheritedValuesFromParent
(FormObject parentObj) overwrites all the values on this form with any values from the parentboolean
org.jpedal.objects.raw.PdfObject
static Color
generateColor
(float[] toks) takes a value, and turns it into the color it represents e.g.int
get status found during decodeint
boolean
getBoolean
(int id) This method should be called only in tabbing functionalityreturn the bounding rectangle for this objectboolean[]
float
org.jpedal.objects.raw.PdfObject
getDictionary
(int id) 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.float[][]
getFloat2DArray
(int id) float[]
getFloatArray
(int id) float
getFloatNumber
(int id) float
Method to get the font size to be used in the form component This is currently only implemented for text pop-up formsint
look at FormFactory.LIST etc for full list of typesint
getInt
(int id) int[]
getIntArray
(int id) String[]
byte[][]
getKeyArray
(int id) used by JS to resetint[]
Method returns matte border details of Form (not all surrounding element)org.jpedal.objects.raw.PdfArrayIterator
getMixedArray
(int id) getName
(int id) int
getNameAsConstant
(int id) Object[]
getObjectArray
(int id) static BufferedImage
org.jpedal.objects.raw.PdfObject
gets the parent for this fieldbyte[][]
int
int[]
int
int
getTextStreamValue
(int id) byte[]
getTextStreamValueAsByte
(int id) 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 captiongetValuesMap
(boolean keyFirst) 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
boolean
void
setActionFlag
(int popup) used internally to set status while parsing - should not be calledvoid
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 Popupsvoid
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
setFontName
(String font) set the text font for this formvoid
setFormType
(int widgetType) void
setFormValue
(Object value) 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
setLastValidValue
(String value) used by JS to resetvoid
setMixedArray
(int id, byte[][] value) void
setName
(int id, byte[] value) 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 statevoid
setObjectArray
(int id, Object[] objectValues) void
setPageRotation
(int rotation) void
sets the parent for this fieldvoid
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 truevoid
setParentPdfObj
(org.jpedal.objects.raw.PdfObject parent) void
setRawKids
(byte[][] kidsInParent) void
setSelected
(boolean setSelected) void
setSelection
(Object[] selectedValues, String curValue, int[] indices, int index) sets the selected item only applicable to the choices fieldsvoid
setTextColor
(float[] color) sets the text color for this formvoid
setTextFont
(Font font) set the text font for this formvoid
setTextSize
(int size) sets the text size for this formvoid
setTextStreamValue
(int id, byte[] value) void
setTextStreamValue
(int id, String value) void
setVisible
(boolean isVisible) void
updateValue
(Object value, boolean isSelected, boolean sync) allow us to update value (and sync to GUI version if existsMethods inherited from class org.jpedal.objects.raw.PdfObject
getArrayRef, getBooleanArray, getByteArray, getCachedStreamFile, getCacheName, getClip, getConvertedData, getDecodedStream, getDoubleArray, getGeneralStringValue, getGeneralType, getID, getKeyPairsIterator, getObjectRefAsString, getObjectRefGeneration, getObjectRefID, getObjectType, getPageNumber, getParentID, getPassword, getPDFkeyInt, getRawObjectType, getStatus, getStringArray, 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, setPageNumber, setRef, setStatus, setStream, setStreamMayBeCorrupt, setStringArray, setStringKey, setUnresolvedData, streamMayBeCorrupt
-
Field Details
-
FieldsHightlightColor
-
READONLY_ID
public static final int READONLY_ID1 form flag indexes for the field flags- See Also:
-
REQUIRED_ID
public static final int REQUIRED_ID2 form flag indexes for the field flags- See Also:
-
NOEXPORT_ID
public static final int NOEXPORT_ID3 form flag indexes for the field flags- See Also:
-
MULTILINE_ID
public static final int MULTILINE_ID13 form flag indexes for the field flags- See Also:
-
PASSWORD_ID
public static final int PASSWORD_ID14 form flag indexes for the field flags- See Also:
-
NOTOGGLETOOFF_ID
public static final int NOTOGGLETOOFF_ID15 form flag indexes for the field flags- See Also:
-
RADIO_ID
public static final int RADIO_ID16 form flag indexes for the field flags- See Also:
-
PUSHBUTTON_ID
public static final int PUSHBUTTON_ID17 form flag indexes for the field flags- See Also:
-
COMBO_ID
public static final int COMBO_ID18 form flag indexes for the field flags- See Also:
-
EDIT_ID
public static final int EDIT_ID19 form flag indexes for the field flags- See Also:
-
MULTISELECT_ID
public static final int MULTISELECT_ID22 form flag indexes for the field flags- See Also:
-
DONOTSCROLL_ID
public static final int DONOTSCROLL_ID24 form flag indexes for the field flags- See Also:
-
RICHTEXT_AND_RADIOINUNISON_ID
public static final int RICHTEXT_AND_RADIOINUNISON_ID26 form flag indexes for the field flags- See Also:
-
POPUP
public static final int POPUP- See Also:
-
-
Constructor Details
-
FormObject
-
FormObject
-
FormObject
public FormObject(int ref, int gen) -
FormObject
public FormObject(int type) -
FormObject
public FormObject() -
FormObject
-
-
Method Details
-
setHTMLElementId
-
getHTMLElementId
-
getBoolean
public boolean getBoolean(int id) - Overrides:
getBoolean
in classorg.jpedal.objects.raw.PdfObject
-
setBoolean
public void setBoolean(int id, boolean value) - Overrides:
setBoolean
in classorg.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 classorg.jpedal.objects.raw.PdfObject
-
setIntNumber
public void setIntNumber(int id, int value) - Overrides:
setIntNumber
in classorg.jpedal.objects.raw.PdfObject
-
getInt
public int getInt(int id) - Overrides:
getInt
in classorg.jpedal.objects.raw.PdfObject
-
setDictionary
public void setDictionary(int id, org.jpedal.objects.raw.PdfObject value) - Overrides:
setDictionary
in classorg.jpedal.objects.raw.PdfObject
-
getNameAsConstant
public int getNameAsConstant(int id) - Overrides:
getNameAsConstant
in classorg.jpedal.objects.raw.PdfObject
-
getMixedArray
public org.jpedal.objects.raw.PdfArrayIterator getMixedArray(int id) - Overrides:
getMixedArray
in classorg.jpedal.objects.raw.PdfObject
-
getTextStreamValueAsByte
public byte[] getTextStreamValueAsByte(int id) - Overrides:
getTextStreamValueAsByte
in classorg.jpedal.objects.raw.PdfObject
-
getIntArray
public int[] getIntArray(int id) - Overrides:
getIntArray
in classorg.jpedal.objects.raw.PdfObject
-
setIntArray
public void setIntArray(int id, int[] value) - Overrides:
setIntArray
in classorg.jpedal.objects.raw.PdfObject
-
setMixedArray
public void setMixedArray(int id, byte[][] value) - Overrides:
setMixedArray
in classorg.jpedal.objects.raw.PdfObject
-
getFloatNumber
public float getFloatNumber(int id) - Overrides:
getFloatNumber
in classorg.jpedal.objects.raw.PdfObject
-
getFloatArray
public float[] getFloatArray(int id) - Overrides:
getFloatArray
in classorg.jpedal.objects.raw.PdfObject
-
setFloatNumber
public void setFloatNumber(int id, float value) - Overrides:
setFloatNumber
in classorg.jpedal.objects.raw.PdfObject
-
setFloatArray
public void setFloatArray(int id, float[] value) - Overrides:
setFloatArray
in classorg.jpedal.objects.raw.PdfObject
-
setName
public void setName(int id, byte[] value) - Overrides:
setName
in classorg.jpedal.objects.raw.PdfObject
-
setObjectArray
- Overrides:
setObjectArray
in classorg.jpedal.objects.raw.PdfObject
-
getObjectArray
- Overrides:
getObjectArray
in classorg.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 classorg.jpedal.objects.raw.PdfObject
-
setTextStreamValue
-
getName
- Overrides:
getName
in classorg.jpedal.objects.raw.PdfObject
-
getTextStreamValue
- Overrides:
getTextStreamValue
in classorg.jpedal.objects.raw.PdfObject
-
getKeyArray
public byte[][] getKeyArray(int id) - Overrides:
getKeyArray
in classorg.jpedal.objects.raw.PdfObject
-
setKeyArray
public void setKeyArray(int id, byte[][] value) - Overrides:
setKeyArray
in classorg.jpedal.objects.raw.PdfObject
-
decompressStreamWhenRead
public boolean decompressStreamWhenRead()- Overrides:
decompressStreamWhenRead
in classorg.jpedal.objects.raw.PdfObject
-
generateColor
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
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
set the text font for this form- Parameters:
font
- the name of the font
-
setTextFont
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
sets the selected item only applicable to the choices fields- Parameters:
selectedValues
- an array of objects containing the selected valuescurValue
- the current valueindices
- an array of indicesindex
- the index of the selected object
-
setParent
sets the parent for this field- Parameters:
parent
- the parent of the field
-
setParent
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 fieldparentObj
- a data object containing details of the parent form objectcopyValuesFromParent
- 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
gets the parent for this field- Returns:
- the parent object reference
-
getBounding2DRectangleForTabbing
This method should be called only in tabbing functionality- Returns:
- the bounded 2d rectangle object
-
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
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
- 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
- Returns:
- the available items for this list or combo
-
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
- 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
- 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
- Returns:
- the text font for this field
-
getFontName
-
getTextColor
- Returns:
- the text color for this field
-
getLayerName
- Returns:
- the name of the layer
-
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
- Returns:
- an Opaque BufferedImage for use when appearance Streams are null
-
setGUIComponent
-
getGUIComponent
-
updateValue
allow us to update value (and sync to GUI version if exists- Parameters:
value
- the new value to update withisSelected
- true if the object is selectedsync
- 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
-
setFormValue
-
getLastValidValue
used by JS to reset- Returns:
- the last valid value
-
setLastValidValue
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
-