Data provider

  • An implementation of PSPDFDataProviding that operates on a single NSData.

    This may be used to initialize PSPDFDocument with data.

    Warning

    You might want to set a custom UID otherwise the UID will be calculated from a part of the PDF contents, which might be the same if the files are similar.

    Note

    When using this data provider, PSPDFKit is unable to automatically save annotation changes back into the PDF. Keep in mind that iOS is an environment without virtual memory. Loading a large PDF will simply get your app killed by the iOS watchdog while you try to allocate more memory than is available.

    If you use NSData because of encryption, look into PSPDFAESCryptoDataProvider or a custom implementation of PSPDFDataProviding instead for a way to dynamically decrypt the needed portions of the PDF.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFDataContainerProvider : NSObject <PSPDFDataProviding>

    Swift

    class PSPDFDataContainerProvider : NSObject, PSPDFDataProviding
  • This protocol is to be used by all possible data providers for PDF access. E.g. a PSPDFFileDataProvider or PSPDFAESCryptoDataProvider.

    Note

    This replaces the CGDataProvider support in earlier versions of the SDK.
    See more

    Declaration

    Objective-C

    @protocol PSPDFDataProviding <NSObject, NSSecureCoding>

    Swift

    protocol PSPDFDataProviding : NSSecureCoding, NSObjectProtocol
  • This protocol allows an implementation of PSPDFDataProviding to return an object that can be used to re-write/append to a data source.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDataSink <NSObject>

    Swift

    protocol PSPDFDataSink : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol PSPDFFileCoordinationDelegate<NSObject>
    
    /**
     Called after the underlying file was modified.
    
     Roughly corresponds to a `presentedItemDidChange` `NSFilePresenter` notification.
     This call is only invoked if the file content changes since the last successful read.
     File metadata updates are ignored. Will be called on a private queue.
    
     @param dataProvider The requesting coordinated file data provider.
     */
    - (void)presentedItemDidChangeForDataProvider:(id<PSPDFCoordinatedFileDataProviding>)dataProvider;
    
    /**
     Called when the underlying file is about to be deleted.
    
     Corresponds to a `accommodatePresentedItemDeletionWithCompletionHandler:` `NSFilePresenter`
     notification. Will be called on a private queue.
    
     @note It is crucial that completionHandler is invoked after this method is handled.
     Best to do it on the same queue and not dispatching. Dispatchign to the main thread
     and invoking the callback can lead to deadlocks if the file is deleted from the main
     thread in the host app.
    
     @param dataProvider The requesting coordinated file data provider.
     @param completionHandler Should be invoked to allow the deletion to continue.
     */
    - (void)accommodatePresentedItemDeletionForDataProvider:(id<PSPDFCoordinatedFileDataProviding>)dataProvider completionHandler:(void (^)(NSError *_Nullable))completionHandler;
    
    @end

    Swift

    protocol PSPDFFileCoordinationDelegate : NSObjectProtocol
  • Resolution options for conflicts due to out of process file changes or deletion.

    See more

    Declaration

    Objective-C

    enum PSPDFFileConflictResolution {}

    Swift

    enum PSPDFFileConflictResolution : UInt