Foxit PDF SDK
|
Public Member Functions | |
Field (PDFDoc document, PDFDictionary field_dict) | |
Constructor, from field dictionary. More... | |
Field (Field field) | |
Constructor, with another form field object. More... | |
int | getAlignment () throws com.foxit.sdk.PDFException |
Get the alignment value. More... | |
String | getAlternateName () throws com.foxit.sdk.PDFException |
Get alternate name. More... | |
Control | getControl (int index) throws com.foxit.sdk.PDFException |
Get a form control by index. More... | |
Control | getControl (PDFPage page, int index) throws com.foxit.sdk.PDFException |
Get a form control by index, in a specified PDF page. More... | |
int | getControlCount () throws com.foxit.sdk.PDFException |
Get count of form controls. More... | |
int | getControlCount (PDFPage page) throws com.foxit.sdk.PDFException |
Get count of form controls in a specified PDF page. More... | |
DefaultAppearance | getDefaultAppearance () throws com.foxit.sdk.PDFException |
Get the default appearance data. More... | |
String | getDefaultValue () throws com.foxit.sdk.PDFException |
Get default value. More... | |
PDFObject | getDefaultValueObj () throws com.foxit.sdk.PDFException |
Get the PDF object of field's default value. More... | |
PDFDictionary | getDict () throws com.foxit.sdk.PDFException |
Get the PDF dictionary of current object. More... | |
int | getFlags () throws com.foxit.sdk.PDFException |
Get field flags. More... | |
PDFObject | getInheritedAttribute (String attribute_name) throws com.foxit.sdk.PDFException |
Get the PDF object for specified attribute which may be inherited from the ancestor node in the field tree. More... | |
String | getMappingName () throws com.foxit.sdk.PDFException |
Get mapping name. More... | |
int | getMaxLength () throws com.foxit.sdk.PDFException |
Get maximum length of the field's text, in characters. More... | |
String | getName () throws com.foxit.sdk.PDFException |
Get field name. More... | |
ChoiceOptionArray | getOptions () throws com.foxit.sdk.PDFException |
Get options of list box or combo box. More... | |
int | getTopVisibleIndex () throws com.foxit.sdk.PDFException |
Get top index of option for scrollable list boxes. More... | |
int | getType () throws com.foxit.sdk.PDFException |
Get field type. More... | |
String | getValue () throws com.foxit.sdk.PDFException |
Get value. More... | |
PDFObject | getValueObj () throws com.foxit.sdk.PDFException |
Get the PDF object of field's value. More... | |
boolean | isEmpty () |
Check whether current object is empty or not. More... | |
boolean | reset () throws com.foxit.sdk.PDFException |
Reset data in current field to its default value. (Not support signature field) More... | |
void | setAlignment (int alignment) throws com.foxit.sdk.PDFException |
Set alignment property of a form, as a document-wide default value. (Not support signature field) More... | |
void | setAlternateName (String alternate_name) throws com.foxit.sdk.PDFException |
Set alternate name. (Not support signature field) More... | |
void | setDefaultAppearance (DefaultAppearance default_ap) throws com.foxit.sdk.PDFException |
Set default appearance data. More... | |
void | setDefaultValue (String value) throws com.foxit.sdk.PDFException |
Set default value. More... | |
void | setFlags (int flags) throws com.foxit.sdk.PDFException |
Set field flags. More... | |
void | setMappingName (String name) throws com.foxit.sdk.PDFException |
Set mapping name. (Not support signature field) More... | |
void | setMaxLength (int max_length) throws com.foxit.sdk.PDFException |
Set maximum length of the field's text, in characters. More... | |
void | setOptions (ChoiceOptionArray option_array) throws com.foxit.sdk.PDFException |
Set options of list box or combo box. More... | |
void | setTopVisibleIndex (int index) throws com.foxit.sdk.PDFException |
Set top index for scrollable list boxes. More... | |
void | setValue (String value) throws com.foxit.sdk.PDFException |
Set value. More... | |
Static Public Attributes | |
static final int | e_FlagButtonNoToggleToOff = 0x100 |
(Only useful for radio button) If set, exactly one radio button must be selected at all times; clicking the currently selected button has no effect. If clear, clicking the selected button deselects it, leaving no button selected. | |
static final int | e_FlagButtonRadiosInUnison = 0x200 |
(Only useful for radio button) 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. | |
static final int | e_FlagChoiseMultiSelect = 0x100 |
(Only useful for combo box and list box) If set, more than one items may be selected simultaneously; if clear, no more than one item at a time may be selected. | |
static final int | e_FlagComboEdit = 0x100 |
(Only useful for combo box) If set, the combo box includes an editable text control with a drop-down list, if clear, it includes only a drop-down list. | |
static final int | e_FlagNoExport = 0x04 |
if set, the field must not be exported by a submit-form action. | |
static final int | e_FlagReadOnly = 0x01 |
If set, the user may not change the value of the field. Any associated widget annotations will not interact with the user; that is, they will not respond to mouse clicks or change their appearance in response to mouse motions. This flag is useful for fields whose values are computed or imported from a database. | |
static final int | e_FlagRequired = 0x02 |
If set, the field must have a value at the time it is exported by a submit-form action. | |
static final int | e_FlagTextComb = 0x800 |
(Only useful for text field) If set, use combs. More... | |
static final int | e_FlagTextDoNotScroll = 0x400 |
(Only useful for text field) If set, the field does 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 is accepted. | |
static final int | e_FlagTextMultiline = 0x100 |
(Only useful for text field) If set, the text field can contain multiple lines of text; if clear, the field's text is restricted to a single line. | |
static final int | e_FlagTextPassword = 0x200 |
(Only useful for text field) 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 should instead be echoed in some unreadable form, such as asterisks or bullet characters. More... | |
static final int | e_TypeCheckBox = 2 |
Form field type: check box. | |
static final int | e_TypeComboBox = 4 |
Form field type: combo box. | |
static final int | e_TypeListBox = 5 |
Form field type: list box. | |
static final int | e_TypePushButton = 1 |
Form field type: push button. | |
static final int | e_TypeRadioButton = 3 |
Form field type: radio button. | |
static final int | e_TypeSignature = 7 |
Form field type: signature field. | |
static final int | e_TypeTextField = 6 |
Form field type: text field. | |
static final int | e_TypeUnknown = 0 |
Form field type: unknown. | |
In a PDF document, form fields appear on any combination of pages and all of them make up a single, global interactive form spanning the entire document. Function Form.getField can use to get a form field from interactive form. This class offers functions to get some information/properties of a form field, reset the form field to its default value, and get form control from form field.
When a form fiels's type is com.foxit.sdk.pdf.interform.Field.e_TypeSignature , the form field object is a signature object in fact.
To access additional actions, please construct an com.foxit.sdk.pdf.actions.AdditionalAction object with Field object.
com.foxit.sdk.pdf.interform.Field.Field | ( | PDFDoc | document, |
PDFDictionary | field_dict | ||
) |
Constructor, from field dictionary.
[in] | document | A valid PDF document. |
[in] | field_dict | A PDF dictionary which represents a form field. It should belong to the PDF document specified by parameter document; |
com.foxit.sdk.pdf.interform.Field.Field | ( | Field | field | ) |
Constructor, with another form field object.
[in] | field | Another form field object. |
int com.foxit.sdk.pdf.interform.Field.getAlignment | ( | ) | throws com.foxit.sdk.PDFException |
Get the alignment value.
Alignment is a property for variable text and it is only useful for text field and list box, which may contain variable text as their content.
If a text field or list box has its own alignment value, the document-wide default alignment value will be ignored; otherwise, the document-wide default alignment value will be used for the text field or list box.
String com.foxit.sdk.pdf.interform.Field.getAlternateName | ( | ) | throws com.foxit.sdk.PDFException |
Get alternate name.
An alternate field name to be used in place of the actual field name wherever the field must be identified in the user interface (such as in error or status messages referring to the field). This text is also useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes.
Control com.foxit.sdk.pdf.interform.Field.getControl | ( | int | index | ) | throws com.foxit.sdk.PDFException |
Get a form control by index.
[in] | index | Form control index. Valid range: from 0 to (count-1). count is returned by function Field.getControlCount . |
Control com.foxit.sdk.pdf.interform.Field.getControl | ( | PDFPage | page, |
int | index | ||
) | throws com.foxit.sdk.PDFException |
Get a form control by index, in a specified PDF page.
[in] | page | A valid PDF page object. It should be in the same document as current form field. |
[in] | index | Form control index. Valid range: from 0 to (count-1). count is returned by function Field.getControlCount with same parameter page. |
int com.foxit.sdk.pdf.interform.Field.getControlCount | ( | ) | throws com.foxit.sdk.PDFException |
Get count of form controls.
int com.foxit.sdk.pdf.interform.Field.getControlCount | ( | PDFPage | page | ) | throws com.foxit.sdk.PDFException |
Get count of form controls in a specified PDF page.
[in] | page | A valid PDF page object. It should be in the same document as current form field. |
DefaultAppearance com.foxit.sdk.pdf.interform.Field.getDefaultAppearance | ( | ) | throws com.foxit.sdk.PDFException |
Get the default appearance data.
String com.foxit.sdk.pdf.interform.Field.getDefaultValue | ( | ) | throws com.foxit.sdk.PDFException |
Get default value.
Applicable for all fields except push button. For field types that are not applicable, an empty string will be returned.
PDFObject com.foxit.sdk.pdf.interform.Field.getDefaultValueObj | ( | ) | throws com.foxit.sdk.PDFException |
Get the PDF object of field's default value.
The format of field's default value varies depending on the field type. For more details, please refer to "TABLE 8.69
Entries common to all field dictionaries" in <PDF reference 1.7> P676.
PDFDictionary com.foxit.sdk.pdf.interform.Field.getDict | ( | ) | throws com.foxit.sdk.PDFException |
Get the PDF dictionary of current object.
int com.foxit.sdk.pdf.interform.Field.getFlags | ( | ) | throws com.foxit.sdk.PDFException |
Get field flags.
Field flags specifies various characteristics of a form field.
PDFObject com.foxit.sdk.pdf.interform.Field.getInheritedAttribute | ( | String | attribute_name | ) | throws com.foxit.sdk.PDFException |
Get the PDF object for specified attribute which may be inherited from the ancestor node in the field tree.
Some of the field attributes are designated as inheritable, such as "Ff", "V", "DV", and so on. Please refer to "TABLE 8.69 Entries common to all field dictionaries" in <PDF Reference 1.7> P675.
[in] | attribute_name | The name of attribute to be found. |
String com.foxit.sdk.pdf.interform.Field.getMappingName | ( | ) | throws com.foxit.sdk.PDFException |
Get mapping name.
Mapping name is to be used when exporting interactive form field data from the document.
int com.foxit.sdk.pdf.interform.Field.getMaxLength | ( | ) | throws com.foxit.sdk.PDFException |
Get maximum length of the field's text, in characters.
Applicable for text fields. For field types that are not applicable, this function will return 0.
String com.foxit.sdk.pdf.interform.Field.getName | ( | ) | throws com.foxit.sdk.PDFException |
Get field name.
ChoiceOptionArray com.foxit.sdk.pdf.interform.Field.getOptions | ( | ) | throws com.foxit.sdk.PDFException |
Get options of list box or combo box.
Applicable for list box and combo box. For field types that are not applicable, this function will return an empty array.
int com.foxit.sdk.pdf.interform.Field.getTopVisibleIndex | ( | ) | throws com.foxit.sdk.PDFException |
Get top index of option for scrollable list boxes.
Applicable for list box. For field types that are not applicable, this function will return 0.
Top index of option is the the index of the first option visible in the list.
int com.foxit.sdk.pdf.interform.Field.getType | ( | ) | throws com.foxit.sdk.PDFException |
Get field type.
String com.foxit.sdk.pdf.interform.Field.getValue | ( | ) | throws com.foxit.sdk.PDFException |
Get value.
Applicable for all fields except push button. For field types that are not applicable, an empty string will be returned.
PDFObject com.foxit.sdk.pdf.interform.Field.getValueObj | ( | ) | throws com.foxit.sdk.PDFException |
Get the PDF object of field's value.
The format of field's value varies depending on the field type. For more details, please refer to "TABLE 8.69 Entries
common to all field dictionaries" in <PDF reference 1.7> P676.
boolean com.foxit.sdk.pdf.interform.Field.isEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
boolean com.foxit.sdk.pdf.interform.Field.reset | ( | ) | throws com.foxit.sdk.PDFException |
Reset data in current field to its default value. (Not support signature field)
void com.foxit.sdk.pdf.interform.Field.setAlignment | ( | int | alignment | ) | throws com.foxit.sdk.PDFException |
Set alignment property of a form, as a document-wide default value. (Not support signature field)
Alignment is a property for variable text and it is only useful for text field and list box, which may contain variable text as their content.
If a text field or list box has its own alignment value, the document-wide default alignment value will be ignored; otherwise, the document-wide default alignment value will be used for the text field or list box.
If current form field is a signature field, this function will do nothing.
[in] | alignment | The new default alignment type of variable text. Please refer to values starting from com.foxit.sdk.common.Constants.e_AlignmentLeft and this should be one of these values. If other values is used to set, com.foxit.sdk.common.Constants.e_AlignmentLeft will be used by default. |
void com.foxit.sdk.pdf.interform.Field.setAlternateName | ( | String | alternate_name | ) | throws com.foxit.sdk.PDFException |
Set alternate name. (Not support signature field)
An alternate field name is to be used in place of the actual field name wherever the field must be identified in the user interface (such as in error or status messages referring to the field). This text is also useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes.
If current form field is a signature field, this function will do nothing.
[in] | alternate_name | A new alternate name string. It should not be an empty string. |
void com.foxit.sdk.pdf.interform.Field.setDefaultAppearance | ( | DefaultAppearance | default_ap | ) | throws com.foxit.sdk.PDFException |
Set default appearance data.
[in] | default_ap | The new default appearance. flags of input data can be used to decide which information is/are to be updated with the new data; for those no updated data, they will keep to use old data. |
void com.foxit.sdk.pdf.interform.Field.setDefaultValue | ( | String | value | ) | throws com.foxit.sdk.PDFException |
Set default value.
Applicable for all fields except push button. For field types that are not applicable, this function will do nothing.
[in] | value | New default value string. It should not be an empty string. |
void com.foxit.sdk.pdf.interform.Field.setFlags | ( | int | flags | ) | throws com.foxit.sdk.PDFException |
Set field flags.
Field flags specifies various characteristics of a form field.
[in] | flags | New form field flags. Please refer to values starting from com.foxit.sdk.pdf.interform.Field.e_FlagReadOnly and this should be one or a combination of these values. |
void com.foxit.sdk.pdf.interform.Field.setMappingName | ( | String | name | ) | throws com.foxit.sdk.PDFException |
Set mapping name. (Not support signature field)
Mapping name is to be used when exporting interactive form field data from the document. If current form field is a signature field, this function will do nothing.
[in] | name | New mapping name string.It should not be an empty string. |
void com.foxit.sdk.pdf.interform.Field.setMaxLength | ( | int | max_length | ) | throws com.foxit.sdk.PDFException |
Set maximum length of the field's text, in characters.
Applicable for text fields. For field types that are not applicable, this function will do nothing.
[in] | max_length | New maximum length of the field's text. It should be non-negative. |
void com.foxit.sdk.pdf.interform.Field.setOptions | ( | ChoiceOptionArray | option_array | ) | throws com.foxit.sdk.PDFException |
Set options of list box or combo box.
Applicable for list box and combo box. For field types that are not applicable, this function will do nothing.
[in] | option_array | An array of options which is to be set to list box or combo box. |
void com.foxit.sdk.pdf.interform.Field.setTopVisibleIndex | ( | int | index | ) | throws com.foxit.sdk.PDFException |
Set top index for scrollable list boxes.
Applicable for list box. For field types that are not applicable, this function will do nothing.
Top index of option is the the index of the first option visible in the list.
[in] | index | The index of the first option visible in the list. |
void com.foxit.sdk.pdf.interform.Field.setValue | ( | String | value | ) | throws com.foxit.sdk.PDFException |
Set value.
Applicable for all fields except push button. For field types that are not applicable, this function will do nothing.
Specially, for combo box and text field, when setting value successfully, this function will also trigger related calculation and formatting events and update the appearance of the field.
[in] | value | New value string. Specially, when current field is a list box field, this parameter can contain multiple values: When to set multiple values, each value should be wrapped by "()". For example, "(ABC)(CCC)" means to set 2 value "ABC" and "CCC". If a value contains "()", or "\\" as its content, please add an additional "\\" as an escape character just in front of each character of "()" or "\\". For example:
|
|
static |
(Only useful for text field) If set, use combs.
If set, the field is automatically divided into as many equally spaced positions, or combs, as the value of maximum length of a field's text, and the text is laid out into those combs.
|
static |
(Only useful for text field) 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 should instead be echoed in some unreadable form, such as asterisks or bullet characters.