PSPDFFormParser


@interface PSPDFFormParser : NSObject

Parses PDF Forms (AcroForms). This will not create objects based on the (soon deprecated) XFA standard. - see: https://pspdfkit.com/guides/ios/current/rendering-issues/pspdfkit-doesnt-show-the-pdf-form/

  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFFormParser : NSObject
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFFormParser : NSObject
  • Attached document provider.

    Declaration

    Objective-C

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

    Swift

    weak var documentProvider: PSPDFDocumentProvider? { get }
  • A collection of all forms in AcroForm. Lazily evaluated.

    Declaration

    Objective-C

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

    Swift

    var forms: [PSPDFFormElement] { get }
  • A collection of all form fields in the AcroForm. Lazily evaluated.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic, nullable)
        NSArray<__kindof PSPDFFormField *> *formFields;

    Swift

    var formFields: [PSPDFFormField]? { get }
  • Return all dirty = unsaved form elements

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        NSArray<__kindof PSPDFFormElement *> *dirtyForms;

    Swift

    var dirtyForms: [PSPDFFormElement]? { get }
  • Finds a form element with its field name. Returns nil if not found.

    Declaration

    Objective-C

    - (nullable __kindof PSPDFFormElement *)findAnnotationWithFieldName:
        (nonnull NSString *)fieldName;

    Swift

    func findAnnotation(withFieldName fieldName: String) -> PSPDFFormElement?
  • Finds a form field with the given fully qualified field name.

    Declaration

    Objective-C

    - (nullable __kindof PSPDFFormField *)findFieldWithFullFieldName:
        (nonnull NSString *)fullFieldName;

    Swift

    func findField(withFullFieldName fullFieldName: String) -> PSPDFFormField?

    Parameters

    fullFieldName

    The fully qualified field name.

    Return Value

    The form field, if found. nil otherwise.

  • Removes the form elements from the AcroForms structure inside the PDF and also removes the visual representation (widget annotation) from the pages.

    Note

    The PSPDFFormField will also be removed if it doesn’t contain any PSPDFFormElement any more.

    Note

    Depending on the size of your document, this operation will be slow and should not be run on the main thread.

    Declaration

    Objective-C

    - (BOOL)removeFormElements:
                (nonnull NSArray<__kindof PSPDFFormElement *> *)formElements
                         error:(NSError *_Nullable *_Nullable)error;

    Swift

    func remove(_ formElements: [PSPDFFormElement]) throws

    Parameters

    formElements

    The PSPDFFormElements to be removed.

    Return Value

    YES if the form elements were removed, NO otherwise.

  • Removes the form fields from the AcroForms structure inside the PDF, removes all linked PSPDFFormElements and their visual representation (widget annotation) from the pages.

    Note

    Depending on the size of your document, this operation will be slow and should not be run on the main thread.

    Declaration

    Objective-C

    - (BOOL)removeFormFields:
                (nonnull NSArray<__kindof PSPDFFormField *> *)formFields
                       error:(NSError *_Nullable *_Nullable)error;

    Swift

    func removeFormFields(_ formFields: [PSPDFFormField]) throws

    Parameters

    formFields

    The PSPDFFormFields to be removed.

    Return Value

    YES if the form elements were removed, NO otherwise.