PSPDFFormElement
Objective-C
@interface PSPDFFormElement : PSPDFWidgetAnnotation <NSSecureCoding>
Swift
class FormElement : WidgetAnnotation, NSSecureCoding
Represents a PDF form element.
-
Returns the form field linked to this annotation.
Declaration
Objective-C
@property (weak, readonly) PSPDFFormField *_Nullable formField;
Swift
weak var formField: PSPDFFormField? { get }
-
Returns true if we can reset this form element to default values.
Declaration
Objective-C
@property (readonly, getter=isResettable) BOOL resettable;
Swift
var isResettable: 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, 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, nullable) id exportValue;
Swift
var exportValue: Any? { get }
-
Color when the annotation is being highlighted.
Note
PSPDFKit extension. Won’t be saved into the PDF.Declaration
Objective-C
@property (nullable) NSColor *highlightColor;
Swift
var highlightColor: NSColor? { get set }
-
The previous control in tab order.
Declaration
Objective-C
@property (weak) PSPDFFormElement *_Nullable next;
Swift
weak var next: FormElement? { get set }
-
The next control in tab order.
Declaration
Objective-C
@property (weak) PSPDFFormElement *_Nullable previous;
Swift
weak var previous: FormElement? { get set }
-
Position of the receiver in the form calculation order list (used when a form with JavaScript scripts must be recalculated). An index of 0 is the first position in that list, an index of 1 is the second position, and so on. For example, if the receiver is the first form field that is recalculated in a form document, then this property has a value of
0
.Declaration
Objective-C
@property (readonly) NSUInteger calculationOrderIndex;
Swift
var calculationOrderIndex: UInt { get }
-
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 reflects the set value for this property on the linked
formField
.Declaration
Objective-C
@property (readonly, getter=isReadOnly) BOOL readOnly;
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 reflects the set value for this property on the linked
formField
.Declaration
Objective-C
@property (readonly, getter=isRequired) BOOL required;
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 reflects the set value for this property on the linked
formField
.Declaration
Objective-C
@property (readonly, getter=isNoExport) BOOL noExport;
Swift
var isNoExport: Bool { get }
-
The partial field name.
Declaration
Objective-C
@property (readonly, nullable) NSString *fieldName;
Swift
var fieldName: String? { get }
-
The T entry in the field dictionary (see Table 220) holds a text string defining the field’s partial field name. The fully qualified field name is not explicitly defined but shall be constructed from the partial field names of the field and all of its ancestors. For a field with no parent, the partial and fully qualified names are the same. For a field that is the child of another field, the fully qualified name shall be formed by appending the child field’s partial name to the parent’s fully qualified name, separated by a PERIOD (2Eh) — PDF Spec
Declaration
Objective-C
@property (readonly, nullable) NSString *fullyQualifiedFieldName;
Swift
var fullyQualifiedFieldName: String? { get }
-
Returns the Form Type Name. “Form Element”, “Text Field” etc
Declaration
Objective-C
@property (readonly) NSString *_Nonnull formTypeName;
Swift
var formTypeName: String { get }
-
The maximum length of the field’s text, in characters. (Optional; inheritable)
Declaration
Objective-C
@property NSUInteger maxLength;
Swift
var maxLength: UInt { get set }
-
Whether the text field should scroll with it’s content.
(PDF 1.4) If set, the field shall 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 shall be accepted for interactive form filling; for non- interactive form filling, the filler should take care not to add more character than will visibly fit in the defined area.
Declaration
Objective-C
@property BOOL doNotScroll;
Swift
var doNotScroll: Bool { get set }
-
Properties for rendering
Declaration
Objective-C
@property BOOL isMultiline;
Swift
var isMultiline: Bool { get set }
-
Draws the form highlight.
Declaration
Objective-C
- (void)drawHighlightInContext:(nonnull CGContextRef)context options:(nullable PSPDFRenderOptions *)renderOptions multiply:(BOOL)shouldMultiply;
Swift
func drawHighlight(in context: CGContext, options renderOptions: PSPDFRenderOptions?, multiply shouldMultiply: Bool)