An implementation of
PSPDFDataProvidingthat operates on a single
This may be used to initialize
You might want to set a custom UID otherwise the
UIDwill be calculated from a part of the PDF contents, which might be the same if the files are similar.
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.
NoteEnsure that your implementation is thread safe. Data might be fetched from multiple threads, in random chunks.
@protocol PSPDFDataProviding <NSObject, NSSecureCoding>
protocol PSPDFDataProviding : NSSecureCoding, NSObjectProtocol
@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
protocol PSPDFFileCoordinationDelegate : NSObjectProtocol