PSPDFFormField

Objective-C


@interface PSPDFFormField : PSPDFModel <PSPDFOverridable>

Swift

class PDFFormField : ModelObject, Overridable

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 Document or PSPDFDocumentProvider.

  • Unavailable

    Not the designated initializer

    Undocumented

    Declaration

    Objective-C

    PSPDF_EMPTY_INIT_UNAVAILABLE
  • Unavailable

    Not the designated initializer

    Undocumented

    Declaration

    Objective-C

    PSPDF_EMPTY_INIT_UNAVAILABLE
  • The document provider that hosts this form field.

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic, readonly) PSPDFFormFieldType type;

    Swift

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

    This is not a unique identifier for the form field across the document. Use fullyQualifiedName for that.

    In the PDF, this is the T entry in the field dictionary.

    Declaration

    Objective-C

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

    Swift

    var name: String? { get }
  • The fully qualified name of the form field.

    Form fields can form a hierarchy in the PDF form. This combines all the ancestor 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 (nonatomic, readonly, 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 (nonatomic, nullable) NSString *mappingName;

    Swift

    var mappingName: String? { get set }
  • (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 (nonatomic, nullable) NSString *alternateFieldName;

    Swift

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

    This property is transient: It’s not persisted in the PDF. To persistently disable editing use the isReadOnly property instead.

    Declaration

    Objective-C

    @property (nonatomic) BOOL isEditable;

    Swift

    var isEditable: Bool { get set }
  • If set, the user may not change the value of the field. This flag is useful for fields whose values are computed or imported from a database.

    This property is persisted in the PDF. To transiently disable editing use the isEditable property instead.

    Declaration

    Objective-C

    @property (nonatomic) BOOL isReadOnly;

    Swift

    var isReadOnly: Bool { get set }
  • 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”).

    Partially supported. A border will be shown around required elements according to requiredFormBorderColor in the RenderOptions, but PSPDFKit will not ensure all required fields are filled before executing a submit form action.

    Declaration

    Objective-C

    @property (nonatomic) BOOL isRequired;

    Swift

    var isRequired: Bool { get set }
  • If set, the field shall not be exported by a submit-form action (see 12.7.5.2, “Submit-Form Action”).

    Not supported. PSPDFKit will read this flag from the PDF and write back changes to its state, but otherwise this flag has no effect on PSPDFKit.

    Declaration

    Objective-C

    @property (nonatomic) BOOL isNoExport;

    Swift

    var isNoExport: Bool { get set }
  • (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 (nonatomic, readonly, 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 (nonatomic, readonly, 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 (nonatomic, nullable) id value;

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger calculationOrderIndex;

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic, readonly) 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 (nonatomic, readonly) 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?