PSPDFFormField


@interface PSPDFFormField : PSPDFModel <PSPDFUndoProtocol, PSPDFJSONSerializing>

A form field represents one logical field in the PDF form. Use a PSPDFFormParser to retrieve them. You can access the form parser from a PSPDFDocument or PSPDFDocumentProvider.

  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFFormField : PSPDFModel <PSPDFUndoProtocol, PSPDFJSONSerializing>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFFormField : PSPDFModel <PSPDFUndoProtocol, PSPDFJSONSerializing>
  • The document provider that hosts this form field.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFDocumentProvider *_Nullable documentProvider;

    Swift

    weak var documentProvider: PSPDFDocumentProvider? { get }
  • The type of the form field.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFFormFieldType type;

    Swift

    var type: PSPDFFormFieldType { get }
  • The name of the form field.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *name;

    Swift

    var name: String? { get }
  • The fully qualified name of the form field. Form fields can form a hierachy in the PDF form. This combines all the parents names and separates them by a single dot to create a string that can uniquely identify a form field across one PDF file.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *fullyQualifiedName;

    Swift

    var fullyQualifiedName: String? { get }
  • (Optional; PDF 1.3) The mapping name that shall be used when exporting interactive form field data from the document.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *mappingName;

    Swift

    var mappingName: String? { get }
  • (Optional; PDF 1.3) An alternate field name that shall be used in place of the actual field name wherever the field shall 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 (see 14.9.3, “Alternate Descriptions”).

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *alternateFieldName;

    Swift

    var alternateFieldName: String? { get }
  • Specifies if the linked form elements are editable in the UI. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL isEditable;

    Swift

    var isEditable: Bool { get set }
  • 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. This is set by the PDF file and can’t be changed by PSPDFKit. See isEditable for disabling interaction with linked form elements.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isReadOnly;

    Swift

    var isReadOnly: Bool { get }
  • If set, the field shall have a value at the time it is exported by a submit- form action (see 12.7.5.2, “Submit-Form Action”). This is set by the PDF file and can’t be changed by PSPDFKit.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isRequired;

    Swift

    var isRequired: Bool { get }
  • If set, the field shall not be exported by a submit-form action (see 12.7.5.2, “Submit-Form Action”). This is set by the PDF file and can’t be changed by PSPDFKit.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isNoExport;

    Swift

    var isNoExport: Bool { get }
  • (Optional; inheritable) The default value to which the field reverts when a reset-form action is executed (see 12.7.5.3, “Reset-Form Action”). The format of this value is the same as that of V.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) id defaultValue;

    Swift

    var defaultValue: Any? { get }
  • The value which the field is to export when submitted. Can return either a string or an array of strings in the case of multiple selection.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) id exportValue;

    Swift

    var exportValue: Any? { get }
  • The value of the field. Can either be a NSString or a NSArray of NSStrings.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) id value;

    Swift

    var value: Any? { get set }
  • Returns the calculation order index.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger calculationOrderIndex;

    Swift

    var calculationOrderIndex: UInt { get }
  • Checks if the form field is dirty.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL dirty;

    Swift

    var dirty: Bool { get }
  • The annotations that represent the visual component of the form field. One form field can have more than one annotation. This is mostly used for radio button groups.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSArray<__kindof PSPDFFormElement *> *_Nonnull annotations;

    Swift

    var annotations: [PSPDFFormElement] { get }
  • Returns the form name for the given annotation. If the formField only contains one annotation, the formField name will be returned. If it contains multiple annotations, a number will be added to the name, according to the PDF standard.

    Declaration

    Objective-C

    - (nullable NSString *)nameForAnnotation:(nonnull PSPDFFormElement *)annotation;

    Swift

    func name(forAnnotation annotation: PSPDFFormElement) -> String?
  • Returns the fully qualified form name for the given annotation. If the formField only contains one annotation, the formField name will be returned. If it contains multiple annotations, a number will be added to the name, according to the PDF standard.

    Declaration

    Objective-C

    - (nullable NSString *)fullyQualifiedNameForAnnotation:
        (nonnull PSPDFFormElement *)annotation;

    Swift

    func fullyQualifiedName(forAnnotation annotation: PSPDFFormElement) -> String?