PSPDFTextFormField
Objective-C
@interface PSPDFTextFormField : PSPDFFormField
Swift
class TextFormField : PDFFormField
Represents a text form field in a PDF form. Allows the user to enter custom text.
-
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
-
Inserts a new
PSPDFTextFormField
into the document.Note
This new form field will automatically be added to the document.
Declaration
Objective-C
+ (nullable instancetype) insertedTextFieldWithFullyQualifiedName: (nonnull NSString *)fullyQualifiedName documentProvider: (nonnull PSPDFDocumentProvider *)documentProvider formElement: (nonnull PSPDFFormElement *)formElement error: (NSError *_Nullable *_Nullable)error;
Swift
class func insertedTextField(withFullyQualifiedName fullyQualifiedName: String, documentProvider: PSPDFDocumentProvider, formElement: PSPDFFormElement) throws -> Self
Parameters
fullyQualifiedName
Each form field is identifiable using its fully qualified name. You can specify any dot separated name.
documentProvider
The document the form field gets inserted in.
formElement
One
PSPDFChoiceFormElement
that will be linked to this form field. The form elements are the visual representation of the form on the page. If the form elements aren’t yet added to the document provider, they will be added.error
The error, if any happens.
Return Value
Either an instance of
PSPDFTextFormField
or nil if an error occurs. -
If set, the field may contain multiple lines of text; if clear, the field’s text shall be restricted to a single line.
Note
EvaluatesPSPDFTextFieldFlagMultiline
in thefieldFlags
.Declaration
Objective-C
@property (nonatomic) BOOL isMultiLine;
Swift
var isMultiLine: Bool { get set }
-
If set, the field is intended for entering a secure password that should not be echoed visibly to the screen.
Note
EvaluatesPSPDFTextFieldFlagPassword
in thefieldFlags
.Declaration
Objective-C
@property (nonatomic) BOOL isPassword;
Swift
var isPassword: Bool { get set }
-
Allows enabling the combing behavior where the field is automatically divided into as many equally spaced positions, or combs, as the value of
maxLength
, and the text is laid out into those combs. Setting this property totrue
enables theComb
flag of the field flags. However, combing behavior is only enabled ifisMultiline
,isPassword
,fileSelect
are set tofalse
andmaxLength
is greater than 0 i.e theMultiLine
,Password
, andFileSelect
flags are disabled and the maximum length of text characters for the field is greater than 0 but not unlimited.Note
EvaluatesPSPDFTextFieldFlagComb
in thefieldFlags
.Warning
Most flags aren’t currently supported. QueryfieldFlags
from thePSPDFFormElement
base class.Declaration
Objective-C
@property (nonatomic) BOOL isComb;
Swift
var isComb: Bool { get set }
Return Value
Returns
true
only when the combing behavior can be enabled. Meaning theComb
flag is enabled by setting this property totrue
withisMultiline
property set tofalse
andmaxLength
is greater than 0. -
(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.
Note
EvaluatesPSPDFTextFieldFlagDoNotScroll
in thefieldFlags
.Declaration
Objective-C
@property (nonatomic) BOOL doNotScroll;
Swift
var doNotScroll: Bool { get set }
-
(PDF 1.5) If set, the value of this field shall be a rich text string (see 12.7.3.4, “Rich Text Strings”). If the field has a value, the RV entry of the field dictionary (Table 222) shall specify the rich text string.
Note
EvaluatesPSPDFTextFieldFlagRichText
in thefieldFlags
.Warning
Most flags aren’t currently supported. QueryfieldFlags
from thePSPDFFormElement
base class.Declaration
Objective-C
@property (nonatomic) BOOL isRichText;
Swift
var isRichText: Bool { get set }
-
(PDF 1.4) If set, text entered in the field shall not be spell-checked.
Note
EvaluatesPSPDFTextFieldFlagDoNotSpellCheck
in thefieldFlags
.Warning
Most flags aren’t currently supported. QueryfieldFlags
from thePSPDFFormElement
base class.Declaration
Objective-C
@property (nonatomic) BOOL doNotSpellCheck;
Swift
var doNotSpellCheck: Bool { get set }
-
(PDF 1.4) If set, the text entered in the field represents the pathname of a file whose contents shall be submitted as the value of the field.
Note
EvaluatesPSPDFTextFieldFlagFileSelect
in thefieldFlags
.Warning
Most flags aren’t currently supported. QueryfieldFlags
from thePSPDFFormElement
base class.Declaration
Objective-C
@property (nonatomic) BOOL fileSelect;
Swift
var fileSelect: Bool { get set }
-
The text value of the text form field.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *text;
Swift
var text: String? { get set }
-
The rich text value of the text form field.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *richText;
Swift
var richText: String? { get set }
-
The maximum length of the field’s text, in characters. Returns 0 if length is unlimited.
Declaration
Objective-C
@property (nonatomic) NSUInteger maxLength;
Swift
var maxLength: UInt { get set }