PSPDFXFDFParser

Objective-C


@interface PSPDFXFDFParser : NSObject

Swift

class XFDFParser : NSObject

Parses data from the XML Forms Data Format (XFDF) standard into PSPDFKit annotations.

  • 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
  • Designated initializer.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithDataProvider:(nonnull id<PSPDFDataProviding>)dataProvider
            documentProvider:(nonnull PSPDFDocumentProvider *)documentProvider;

    Swift

    init(dataProvider: DataProviding, documentProvider: PSPDFDocumentProvider)
  • Whether to ignore page transform matrices (rotation and CropBox offset) when parsing.

    Defaults to false.

    Must be set before parsing.

    Declaration

    Objective-C

    @property (nonatomic) BOOL ignorePageRotation;

    Swift

    var ignorePageRotation: Bool { get set }
  • Parse XML and block until it’s done. Returns the resulting annotations after parsing is finished (which can also be accessed later on). PDFFormField will not be returned by this method, but if values were imported they are now set in the appropriate fields on documentProvider.formParser.formFields.

    Note

    Annotations returned by this API will not be added to the document provider. They are detached. If you want to add them to a document, use the Document.add(annotations:) API.

    Warning

    If the XFDF contains annotations with page indices beyond the length of the document, then warnings will be logged and those annotations will be skip but otherwise parsing will complete successfully. It will not return an error for this case.

    @returns Parsed annotations. Also available via the annotations property after parsing.

    Declaration

    Objective-C

    - (nullable NSArray<PSPDFAnnotation *> *)parseWithError:
        (NSError *_Nullable *_Nullable)error;

    Swift

    func parse() throws -> [Annotation]
  • Return all annotations as array. Annotations are sorted by page.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<PSPDFAnnotation *> *_Nonnull annotations;

    Swift

    var annotations: [Annotation] { get }
  • Returns true if parsing has ended for dataProvider.

    Declaration

    Objective-C

    @property (readonly) BOOL parsingEnded;

    Swift

    var parsingEnded: Bool { get }
  • The attached document provider.

    Declaration

    Objective-C

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

    Swift

    weak var documentProvider: PSPDFDocumentProvider? { get }
  • The used data provider.

    Declaration

    Objective-C

    @property (nonatomic, readonly) id<PSPDFDataProviding> _Nonnull dataProvider;

    Swift

    var dataProvider: DataProviding { get }