Other Protocols

The following protocols are available globally.

  • To be notified on any changes PSPDFKit does on your annotations, implement this notifier. It will be set as soon as your class is added to the annotationManager.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationProviderChangeNotifier <NSObject>

    Swift

    protocol PSPDFAnnotationProviderChangeNotifier : NSObjectProtocol
  • Delegate for callbacks related to annotation saving.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationProviderDelegate <NSObject>

    Swift

    protocol PSPDFAnnotationProviderDelegate : NSObjectProtocol
  • Deprecated

    Deprecated in PSPDFKit 4.1 for macOS. PSPDFKit now handles refreshing internally via PSPDFContainerAnnotationProvider.

    Protocol to be implemented by any annotation provider that allows refreshing of its annotations in response to an external change, like from -[PSPDFDocumentProvider setRotationOffset:forPageAtIndex:]. To put that in other words, an annotation provider must implement this protocol for temporary page rotations to work correctly.

    However, this protocol is deprecated because it is very hard to implement correctly. PSPDFContainerAnnotationProvider conforms to this protocol, which means that PSPDFKit can handle refreshing annotations internally. In a future release, this protocol will be removed, and PSPDFContainerAnnotationProvider will continue to implement refreshing internally.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationProviderRefreshing <PSPDFAnnotationProvider>

    Swift

    protocol PSPDFAnnotationProviderRefreshing : PSPDFAnnotationProvider
  • Protocol adopted by PSPDFColorPreset and PSPDFBorderStylePreset.

    Declaration

    Objective-C

    @protocol PSPDFStylePreset <NSObject, NSSecureCoding>

    Swift

    protocol PSPDFStylePreset : NSSecureCoding, NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol PSPDFBackForwardActionListDelegate<NSObject>
    
    /**
     Should execute the provided back actions in reverse order and also call `registerAction:`
     to register the inverse actions.
     */
    - (void)backForwardList:(PSPDFBackForwardActionList *)list requestedBackActionExecution:(NSArray<__kindof PSPDFAction *> *)actions;
    
    /**
     Should execute the provided forward actions in reverse order and also call `registerAction:`
     to register the inverse actions.
     */
    - (void)backForwardList:(PSPDFBackForwardActionList *)list requestedForwardActionExecution:(NSArray<__kindof PSPDFAction *> *)actions;
    
    @optional
    
    /// Called whenever `backList` or `forwardList` get updated.
    - (void)backForwardListDidUpdate:(PSPDFBackForwardActionList *)list;
    
    @end

    Swift

    protocol PSPDFBackForwardActionListDelegate : NSObjectProtocol
  • Delegate that can be implemented to be notified of changes that the document editor performs.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentEditorDelegate <NSObject>

    Swift

    protocol PSPDFDocumentEditorDelegate : NSObjectProtocol
  • Implemented in classes that use or modify the document editor configuration.

    See

    e.g. PSPDFNewPageViewController
    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentEditorConfigurationConfigurable <NSObject>

    Swift

    protocol PSPDFDocumentEditorConfigurationConfigurable : NSObjectProtocol
  • A document feature source can disable various features if there are reasons within its controlled scope that make this feature unavailable.

    You can implement your own sources by conforming to this protocol. Besides the required methods you should only implement the features that your source actually control. The result of your source will be combined with the results of the framework’s sources through a logical AND. This means if your source disallows a feature this feature is no longer available, however if your source allows a feature there might still be other sources disallowing a feature. Only if all sources allow a feature, the feature will be enabled.

    Caching

    The results of all features you implement will be cached. Whenever the state of a feature changes, you need to call [features updateFeatures] for changes to take effect. This is also necessary to allow notifying interested observers about the change in state.

    Threading

    Your custom sources have to be thread safe. They are not guaranteed to be called on any particular queue.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentFeaturesSource <NSObject>

    Swift

    protocol PSPDFDocumentFeaturesSource : NSObjectProtocol
  • An observer will be returned to you when you start observing a feature for state changes. You can either keep the observer around for removing it later on or you can bind it to the lifetime of another class which will then remove the observer automatically when the other object gets deallocated.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentFeaturesObserver <NSObject>

    Swift

    protocol PSPDFDocumentFeaturesObserver : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol PSPDFDownloadManagerDelegate<NSObject>
    
    @optional
    
    /// If the delegate wants to handle authentication challenges.
    - (void)downloadManager:(PSPDFDownloadManager *)downloadManager authenticationChallenge:(NSURLAuthenticationChallenge *)authenticationChallenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler;
    
    /// Informs the delegate that the state of the given object has changed.
    ///
    /// @param downloadManager The download manager.
    /// @param object The changed object.
    - (void)downloadManager:(PSPDFDownloadManager *)downloadManager didChangeObject:(id<PSPDFRemoteContentObject>)object;
    
    /// Informs the delegate that the reachability has changed.
    ///
    /// @param downloadManager The download manager.
    /// @param reachability The new reachability.
    - (void)downloadManager:(PSPDFDownloadManager *)downloadManager reachabilityDidChange:(PSPDFReachability)reachability;
    
    @end

    Swift

    protocol PSPDFDownloadManagerDelegate : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol PSPDFDownloadManagerPolicy<NSObject>
    
    /// Returns YES when we're allowed to use the network.
    @property (nonatomic, readonly) BOOL hasPermissionForNetworkEvent;
    
    @end

    Swift

    protocol PSPDFDownloadManagerPolicy : NSObjectProtocol
  • The PSPDFExternalSignature protocol is adopted by an object that provides an external signature for a PDF document. You set the externalSignatureDelegate property in a PSPDFSigner class or subclass when you want to control the digital signing process with an external signature (for example, a signature that is implemented by a hardware device or by an external webservice).

    See more

    Declaration

    Objective-C

    @protocol PSPDFExternalSignature <NSObject>

    Swift

    protocol PSPDFExternalSignature : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol PSPDFSettings<NSObject>
    
    ///// Allow generic array access.
    - (nullable id)objectForKeyedSubscript:(PSPDFSettingKey)key;
    
    /// Shortcut that returns booleans.
    - (BOOL)boolForKey:(PSPDFSettingKey)key;
    
    @end

    Swift

    protocol PSPDFSettings : NSObjectProtocol
  • The PSPDFLibraryDataSource protocol is adopted by an object that provides the documents to be indexed by a PSPDFLibrary. These methods will not be called on the main queue, and can take long to execute. If you are implementing this protocol yourself and not using PSPDFLibraryFileSystemDataSource, please read the documentation carefully.

    See more

    Declaration

    Objective-C

    @protocol PSPDFLibraryDataSource <NSObject>

    Swift

    protocol PSPDFLibraryDataSource : NSObjectProtocol
  • The type implementing this protocol can receive updates from a PSPDFProcessor.

    See more

    Declaration

    Objective-C

    @protocol PSPDFProcessorDelegate <NSObject>

    Swift

    protocol PSPDFProcessorDelegate : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol PSPDFRemoteContentObject<NSObject>
    
    /// The URL request used for loading the remote content.
    @property (nonatomic, readonly, nullable) NSURLRequest *URLRequestForRemoteContent;
    
    /// The remote content of the object. This property is managed by `PSPDFDownloadManager`.
    @property (nonatomic, nullable) id remoteContent;
    
    @optional
    
    /// The loading state of the object. This property is managed by `PSPDFDownloadManager`.
    @property (nonatomic, getter=isLoadingRemoteContent) BOOL loadingRemoteContent;
    
    /// The download progress of the object. Only meaningful if `loadingRemoteContent` is YES.
    /// This property is managed by `PSPDFDownloadManager`.
    @property (nonatomic) CGFloat remoteContentProgress;
    
    /// The remote content error of the object. This property is managed by `PSPDFDownloadManager`.
    @property (nonatomic, nullable) NSError *remoteContentError;
    
    /// Return YES if you want `PSPDFDownloadManager` to cache the remote content. Defaults to NO.
    @property (nonatomic, readonly) BOOL shouldCacheRemoteContent;
    
    /// Return YES if you want `PSPDFDownloadManager` to retry downloading remote content if a connection
    /// error occurred. Defaults to NO.
    @property (nonatomic, readonly) BOOL shouldRetryLoadingRemoteContentOnConnectionFailure;
    
    /// Return a block if you need to handle a authentication challenge.
    @property (nonatomic, readonly) PSPDFRemoteContentObjectAuthenticationBlock remoteContentAuthenticationChallengeBlock;
    
    /// Return a custom `PSPDFRemoteContentObjectTransformerBlock`. The passed-in `NSURL` points to the
    /// file that stores the downloaded data. The return value is set to `remoteContent`. If no transformer
    /// block is provided, `remoteContent` will be set to data (represented by `NSData`) of the downloaded
    /// content.
    ///
    /// @note If `shouldCacheRemoteContent` returns `YES` the location of the file is not temporary.
    /// @note `remoteContentTransformerBlock` will be called on a background queue, so you may perform
    /// long-running tasks.
    /// @warning Since this runs on a background queue, you should not access state outside of the block's
    /// scope to avoid thread-safety problems.
    @property (nonatomic, readonly, nullable) PSPDFRemoteContentObjectTransformerBlock remoteContentTransformerBlock;
    
    /// Return `YES` if the object actually has remote content. Since most `PSPDFRemoteContentObject`s
    /// will have remote content, this method is optional. If it is not implemented, `YES` will be assumed.
    @property (nonatomic, readonly) BOOL hasRemoteContent;
    
    /// The completion block, called after loading finished.
    @property (nonatomic, copy, nullable) void (^completionBlock)(id<PSPDFRemoteContentObject> remoteObject);
    
    @end

    Swift

    protocol PSPDFRemoteContentObject : NSObjectProtocol
  • Implement this delegate to get rendered pages. (Most of the times, you want to use PSPDFCache instead)

    See more

    Declaration

    Objective-C

    @protocol PSPDFRenderTaskDelegate <NSObject>

    Swift

    protocol PSPDFRenderTaskDelegate : NSObjectProtocol
  • Search status delegate. All delegates are guaranteed to be called within the main thread.

    See more

    Declaration

    Objective-C

    @protocol PSPDFTextSearchDelegate <NSObject>

    Swift

    protocol PSPDFTextSearchDelegate : NSObjectProtocol