Foxit PDF SDK
FSField Class Reference
Inheritance diagram for FSField:
FSBase FSSignature

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...
 
FSDefaultAppearancedefaultAppearance
 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...
 
FSChoiceOptionArrayoptions
 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]indexForm 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]pageA 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]pageA valid PDF page object. It should be in the same document as current form field.
[in]indexForm 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.

◆ getDict()

- (FSPDFDictionary *) getDict

Get the PDF dictionary of current object.

Returns
The PDF dictionary of current object.

◆ 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.

Parameters
[in]attribute_nameThe 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.

◆ initWithDocument:field_dict:()

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

Constructor, from field dictionary.

Parameters
[in]documentA valid PDF document.
[in]field_dictA 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]fieldAnother 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
readwritenonatomicassign

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

◆ alternateName

- (NSString *) alternateName
readwritenonatomicweak

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
readwritenonatomicweak

Get or Set default value.

Applicable for all fields except push button. For field types that are not applicable, an empty string will be returned.

◆ flags

- (unsigned int) flags
readwritenonatomicassign

Get or Set field flags.

Field flags specifies various characteristics of a form field.

◆ mappingName

- (NSString *) mappingName
readwritenonatomicweak

Get or Set mapping name.

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

◆ maxLength

- (int) maxLength
readwritenonatomicassign

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
readwritenonatomicweak

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
readwritenonatomicassign

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

◆ value

- (NSString *) value
readwritenonatomicweak

Get or Set value.

Applicable for all fields except push button. For field types that are not applicable, an empty string will be returned.