Protocols

The following protocols are available globally.

  • Trait for the types that can be found in the fields property of form actions.

    Declaration

    Objective-C

    @protocol PSPDFFormFieldIdentifier <NSObject>

    Swift

    protocol PSPDFFormFieldIdentifier : NSObjectProtocol
  • With the annotation provider, you can mix in PDF annotations from any source (custom database, web, etc) Implement your custom provider class and register it in the PSPDFAnnotationManager.

    (Make sure to register the provider in the PSPDFDocument’s didCreateDocumentProvider: method, since a PSPDFDocument can have multiple PSPDFDocumentProviders and thus multiple PSPDFAnnotationProviders - and they can also be discarded on low memory situations.)

    Ensure everything is thread safe here - methods will be called from any threads and sometimes even concurrently at the same time. (If you’re doing parsing, block and then in the queue re-check so you’re not parsing multiple times for the same page)

    Note

    You should always use PSPDFContainerAnnotationProvider as the base class for your custom annotation provider.
    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationProvider <NSObject>

    Swift

    protocol AnnotationProvider : NSObjectProtocol
  • 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 AnnotationProviderChangeNotifier : NSObjectProtocol
  • Delegate for callbacks related to annotation saving.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationProviderDelegate <NSObject>

    Swift

    protocol AnnotationProviderDelegate : 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 : AnnotationProvider
  • Protocol adopted by PSPDFColorPreset and PSPDFBorderStylePreset.

    Declaration

    Objective-C

    @protocol PSPDFStylePreset <NSObject, NSSecureCoding>

    Swift

    protocol PSPDFStylePreset : NSSecureCoding, NSObjectProtocol
  • The annnotation style manager will save UI-specific properties for annotations and apply them after creation.

    It also offers a selection of user-defined styles. There are three categories: Last used, key-specific and generic styles.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationStyleManager

    Swift

    protocol AnnotationStyleManager
  • Protcol allowing annotation updates.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAnnotationUpdate <NSObject>

    Swift

    protocol AnnotationUpdate : NSObjectProtocol
  • A instance of this protocol can be set on any PSPDFAnnotation and instead of using the PSPDFKit provided appearance stream generation methods, any PDF can be returned.

    The annotation will use the first page of the returned PDF as its appearance and this content will be embedded into the PDF.

    See more

    Declaration

    Objective-C

    @protocol PSPDFAppearanceStreamGenerating <NSObject>

    Swift

    protocol AppearanceStreamGenerating : NSObjectProtocol
  • The security auditor protocol defines a custom set of overrides for various security related tasks.

    See more

    Declaration

    Objective-C

    @protocol PSPDFApplicationPolicy

    Swift

    protocol ApplicationPolicy
  • An object to handle events from a BackForwardActionList.

    Implementing one of each of the requestedBackActionExecution and requestedForwardActionExecution methods is required. They are marked optional during the deprecation transitional period.

    See more

    Declaration

    Objective-C

    @protocol PSPDFBackForwardActionListDelegate <NSObject>

    Swift

    protocol BackForwardActionListDelegate : NSObjectProtocol
  • A Bookmark Provider is used to store and read bookmarks from a data source.

    If you need to store bookmarks in a file format other than what PSPDFKit supports by default, you can create your own bookmark provider and attach it to a document’s bookmark manager.

    See

    PSPDFBookmarkManager

    See

    PSPDFBookmarksChangedNotification for change notifications.
    See more

    Declaration

    Objective-C

    @protocol PSPDFBookmarkProvider <NSObject>

    Swift

    protocol BookmarkProvider : NSObjectProtocol
  • File-based data providers that support file coordination (NSFileCoordinator).

    See more

    Declaration

    Objective-C

    @protocol PSPDFCoordinatedFileDataProviding <PSPDFFileDataProviding>

    Swift

    protocol CoordinatedFileDataProviding : FileDataProviding
  • Methods that need to be implemented by the coordinationDelegate of a coordinated file data provider. As such, all methods in this protocol are required.

    See more

    Declaration

    Objective-C

    @protocol PSPDFFileCoordinationDelegate <NSObject>

    Swift

    protocol FileCoordinationDelegate : NSObjectProtocol
  • This protocol is to be used by all possible data providers for PDF access. E.g. a FileDataProvider or AESCryptoDataProvider.

    Note

    Ensure that your implementation is thread safe. Data might be fetched from multiple threads, in random chunks.
    See more

    Declaration

    Objective-C

    @protocol PSPDFDataProviding <NSObject, NSSecureCoding>

    Swift

    protocol DataProviding : 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 DataSink : NSObjectProtocol
  • Support for database encryption. If you intend to use database encryption features, you must provide an implementation of PSPDFDatabaseEncryptionProvider by setting -[PSPDFKitGlobal setDatabaseEncryptionProvider:].

    See more

    Declaration

    Objective-C

    @protocol PSPDFDatabaseEncryptionProvider <NSObject>

    Swift

    protocol DatabaseEncryptionProvider : NSObjectProtocol
  • Delegate to receive events regarding PSPDFDocument.

    This delegate offers callbacks for custom actions after save events.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentDelegate <NSObject>

    Swift

    protocol PDFDocumentDelegate : 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 PDFDocumentEditorDelegate : 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 PDFDocumentEditorConfigurationConfigurable : 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 PDFDocumentFeaturesSource : 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 PDFDocumentFeaturesObserver : NSObjectProtocol
  • Delegate for writing annotations.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentProviderDelegate <NSObject>

    Swift

    protocol DocumentProviderDelegate : NSObjectProtocol
  • A data source that, when configured on a PSPDFSigner instance or one of its subclasses, gives implementors a chance to configure some details of a digital signature.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentSignerDataSource <NSObject>

    Swift

    protocol PDFDocumentSignerDataSource : NSObjectProtocol
  • A PSPDFDocumentSignerDelegate gives flexibility to the process of adding a digital signature to a document.

    Implement the documentSigner:signData:hashAlgorithm:completion method to sign the required data and invoke completion when ready. The document signer will automatically embed the signed data inside the signature.

    See more

    Declaration

    Objective-C

    @protocol PSPDFDocumentSignerDelegate <NSObject>

    Swift

    protocol PDFDocumentSignerDelegate : 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 DownloadManagerDelegate : 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 DownloadManagerPolicy : 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 ExternalSignature : NSObjectProtocol
  • A more specialized protocol for data providers backed by local files.

    See more

    Declaration

    Objective-C

    @protocol PSPDFFileDataProviding <PSPDFDataProviding>

    Swift

    protocol FileDataProviding : DataProviding
  • Wraps file system calls. Internal class cluster. Can be replaced with Enterprise SDK wrappers like Good Technology or MobileIron AppConnect.

    See more

    Declaration

    Objective-C

    @protocol PSPDFFileManager <NSObject>

    Swift

    protocol FileManager : 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 LibraryDataSource : NSObjectProtocol
  • This protocol defines a method to override the document that the PSPDFLibraryFileSystemDataSource vends to the PSPDFLibrary.

    See more

    Declaration

    Objective-C

    @protocol PSPDFLibraryFileSystemDataSourceDocumentProvider <NSObject>

    Swift

    protocol LibraryFileSystemDataSourceDocumentProvider : NSObjectProtocol
  • Annotates a class that can be overriden with a more specific subclass.

    Declaration

    Objective-C

    @protocol PSPDFOverridable <NSObject>

    Swift

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

    See more

    Declaration

    Objective-C

    @protocol PSPDFProcessorDelegate <NSObject>

    Swift

    protocol ProcessorDelegate : 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 RemoteContentObject : NSObjectProtocol
  • The PDF render manager coordinates the PDF renderer used.

    See more

    Declaration

    Objective-C

    @protocol PSPDFRenderManager <NSObject>

    Swift

    protocol RenderManager : 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 RenderTaskDelegate : NSObjectProtocol
  • Annotations that can be rotated conform to this protocol.

    See more

    Declaration

    Objective-C

    @protocol PSPDFRotatable <NSObject>

    Swift

    protocol Rotatable : NSObjectProtocol
  • An interface for producing content that will be inside the Contents key of a signature dictionary.

    This interface abstracts the digital signature that can be in a signature form field so that you can create your own and place it inside the document. You can call -[PSPDFSigner prepareFormElement:toBeSignedWithAppearance:contents:writingToDataSink:completion:] and pass an instance of this interface to prepare a document for digital signing.

    See more

    Declaration

    Objective-C

    @protocol PSPDFSignatureContents <NSObject>

    Swift

    protocol PDFSignatureContents : 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 TextSearchDelegate : NSObjectProtocol
  • Implement on model objects that should allow undo/redo.

    See more

    Declaration

    Objective-C

    @protocol PSPDFUndoSupport <NSObject>

    Swift

    protocol UndoSupport : NSObjectProtocol