Foxit PDF SDK

Instance Methods | Properties | List of all members
FSField Class Reference
Inheritance diagram for FSField:

## Instance Methods
(FSControl *) | - getControl:
| Get a form control by index. More...
(int) | - getControlCount
| Get count of form controls. More...
(int) | - getControlCountWithPDFPage:
| Get count of form controls in a specified PDF page. More...
(FSControl *) | - getControlWithPDFPage:index:
| Get a form control by index, in a specified PDF page. More...
(FSPDFObject *) | - getDefaultValueObj
| Get the PDF object of field's default value. More...
(FSPDFDictionary *) | - getDict
| Get the PDF dictionary of current object. More...
(FSPDFObject *) | - getInheritedAttribute:
| Get the PDF object for specified attribute which may be inherited from the ancestor node in the field tree. More...
(NSString *) | - getName
| Get field name. More...
(FSFieldType) | - getType
| Get field type. More...
(FSPDFObject *) | - getValueObj
| Get the PDF object of field's value. More...
(id) | - initWithDocument:field_dict:
| Constructor, from field dictionary. More...
(id) | - initWithField:
| Constructor, with another form field object. More...
(BOOL) | - isEmpty
| Check whether current object is empty or not. More...
(BOOL) | - reset
| Reset data in current field to its default value. (Not support signature field) More...

## Properties
FSAlignment | alignment
| Get or Set the alignment value. More...
NSString * | alternateName
| Get or Set alternate name. More...
FSDefaultAppearance * | defaultAppearance
| Get or Set the default appearance data.
NSString * | defaultValue
| Get or Set default value. More...
unsigned int | flags
| Get or Set field flags. More...
NSString * | mappingName
| Get or Set mapping name. More...
int | maxLength
| Get or Set maximum length of the field's text, in characters. More...
FSChoiceOptionArray * | options
| Get or Set options of list box or combo box. More...
int | topVisibleIndex
| Get or Set top index of option for scrollable list boxes. More...
NSString * | value
| Get or Set value. More...

## Detailed Description

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 FSForm::getField:filter: 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 FSFieldTypeSignature, the form field object is a signature object in fact.
To access additional actions, please construct an FSAdditionalAction object with Field object.

See also
  FSForm
  FSSignature
  FSAdditionalAction

## Method Documentation

## ◆ getControl:()

- (FSControl *) getControl: |  | (int) | index |

Get a form control by index.

Parameters

  [in] | index | Form control index. Valid range: from 0 to (count-1). count is returned by function FSField::getControlCount.

Returns
  A form control object.

## ◆ getControlCount()

- (int) getControlCount |  |  |

Get count of form controls.

Returns
  The count of the form controls.

## ◆ getControlCountWithPDFPage:()

- (int) getControlCountWithPDFPage: |  | (FSPDFPage*) | page |

Get count of form controls in a specified PDF page.

Parameters

  [in] | page | A valid PDF page object. It should be in the same document as current form field.

Returns
  The count of the form controls in the specified PDF page.

## ◆ getControlWithPDFPage:index:()

- (FSControl *) getControlWithPDFPage: |  | (FSPDFPage*) | page
index: |  | (int) | index

Get a form control by index, in a specified PDF page.

Parameters

  [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 FSField::getControlCount with same parameter page.

Returns
  form control object.

## ◆ getDefaultValueObj()

- (FSPDFObject *) getDefaultValueObj |  |  |

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.

Returns
  A PDF object. If there is no "DV" entry or any error occurs, this function will return nil.

## ◆ getDict()

- (FSPDFDictionary *) getDict |  |  |

Get the PDF dictionary of current object.

Returns
  The PDF dictionary of current object. If there is any error, the function will return nil.

## ◆ getInheritedAttribute:()

- (FSPDFObject *) getInheritedAttribute: |  | (NSString *) | attribute_name |

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. If there is no entry which is specified by attribute_name or any error occurs, this function will return nil.

Parameters

  [in] | attribute_name | The name of attribute to be found.

Returns
  A PDF object. If not found, this function will return nil.

## ◆ getName()

- (NSString *) getName |  |  |

Get field name.

Returns
  Field name string.

## ◆ getType()

- (FSFieldType) getType |  |  |

Get field type.

Returns
  Form field type. Please refer to values starting from FSFieldTypeUnknown and this would be one of these values.

## ◆ getValueObj()

- (FSPDFObject *) getValueObj |  |  |

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.

Returns
  A PDF object. If there is no "V" entry or any error occurs, this function will return nil.

## ◆ initWithDocument:field_dict:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document
field_dict: |  | (FSPDFDictionary*) | field_dict

Constructor, from field dictionary.

Parameters

  [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;

## ◆ initWithField:()

- (id) initWithField: |  | (FSField*) | field |

Constructor, with another form field object.

Parameters

  [in] | field | Another form field object.

Reimplemented in FSSignature.

## ◆ isEmpty()

- (BOOL) isEmpty |  |  |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  YES means current object is empty, while NO means not.

Reimplemented in FSSignature.

## ◆ reset()

- (BOOL) reset |  |  |

Reset data in current field to its default value. (Not support signature field)

Returns
  YES means success, while NO means current form field is a signature field or failure.

## Property Documentation

## ◆ alignment

- (FSAlignment) alignment
| read write nonatomic assign

Get or Set the alignment value.

Alignment is a property for variable text and it is only useful for text field, list box and combo 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.

## ◆ alternateName

- (NSString *) alternateName
| read write nonatomic weak

Get or Set 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.

## ◆ defaultValue

- (NSString *) defaultValue
| read write nonatomic weak

Get or Set default value.

Applicable for all fields except push button.

## ◆ flags

- (unsigned int) flags
| read write nonatomic assign

Get or Set field flags.

Field flags specifies various characteristics of a form field.

## ◆ mappingName

- (NSString *) mappingName
| read write nonatomic weak

Get or Set mapping name.

Mapping name is to be used when exporting interactive form field data from the document.

## ◆ maxLength

- (int) maxLength
| read write nonatomic assign

Get or Set 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.

## ◆ options

- (FSChoiceOptionArray *) options
| read write nonatomic weak

Get or 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 return an empty array.

## ◆ topVisibleIndex

- (int) topVisibleIndex
| read write nonatomic assign

Get or Set 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 index of the first option visible in the list.

## ◆ value

- (NSString *) value
| read write nonatomic weak

Get or Set value.

Applicable for all fields except push button. For field types that are not applicable, an empty string will be returned. For check box and radio box, this function will return the appearance state value.