Other 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
-
Protocol for analytics events consumers. Implement this protocol to forward analytics events to an analytics service of your choice. To receive events you must register your
See morePSPDFAnalyticsClient
instance with-[PSPDFAnalytics addAnalyticsClient:]
method.Declaration
Objective-C
@protocol PSPDFAnalyticsClient
Swift
protocol PDFAnalyticsClient
-
Delegate to be notified on signature actions.
See moreDeclaration
Objective-C
@protocol PSPDFAnnotationGridViewControllerDelegate <NSObject>
Swift
protocol AnnotationGridViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFAnnotationGridViewControllerDataSource<NSObject> /// Returns number of sections. - (NSInteger)numberOfSectionsInAnnotationGridViewController:(PSPDFAnnotationGridViewController *)annotationGridController; /// Returns number of annotation sets per `section`. - (NSInteger)annotationGridViewController:(PSPDFAnnotationGridViewController *)annotationGridController numberOfAnnotationsInSection:(NSInteger)section; /// Returns the annotation set for `indexPath`. - (PSPDFAnnotationSet *)annotationGridViewController:(PSPDFAnnotationGridViewController *)annotationGridController annotationSetForIndexPath:(NSIndexPath *)indexPath; @end
Swift
protocol AnnotationGridViewControllerDataSource : 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
See moreannotationManager
.Declaration
Objective-C
@protocol PSPDFAnnotationProviderChangeNotifier <NSObject>
Swift
protocol AnnotationProviderChangeNotifier : NSObjectProtocol
-
Delegate for callbacks related to annotation saving.
See moreDeclaration
Objective-C
@protocol PSPDFAnnotationProviderDelegate <NSObject>
Swift
protocol AnnotationProviderDelegate : NSObjectProtocol
-
The annotation state manager delegate is informed of state changes.
Note
The manager class supports registering multiple delegate implementations.Declaration
Objective-C
@protocol PSPDFAnnotationStateManagerDelegate <NSObject>
Swift
protocol AnnotationStateManagerDelegate : NSObjectProtocol
-
Protocol adopted by
PSPDFColorPreset
andPSPDFBorderStylePreset
.Declaration
Objective-C
@protocol PSPDFStylePreset <NSObject, NSSecureCoding>
Swift
protocol PSPDFStylePreset : NSSecureCoding, NSObjectProtocol
-
Delegate for
See moreAnnotationStyleViewController
.Declaration
Objective-C
@protocol PSPDFAnnotationStyleViewControllerDelegate <NSObject>
Swift
protocol AnnotationStyleViewControllerDelegate : NSObjectProtocol
-
Delegate for the
See moreAnnotationTableViewController
.Declaration
Objective-C
@protocol PSPDFAnnotationTableViewControllerDelegate <NSObject>
Swift
protocol AnnotationTableViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFAppearanceModeManagerDelegate<NSObject> @optional /// Provides the document render options for the specified mode. /// /// @param manager A reference to the invoking appearance mode manager. /// @param mode The mode that is about to be applied. /// /// @note Overrides the default behavior, if implemented. - (PSPDFRenderOptions *)appearanceManager:(PSPDFAppearanceModeManager *)manager renderOptionsForMode:(PSPDFAppearanceMode)mode; @end
Swift
protocol AppearanceModeManagerDelegate : NSObjectProtocol
-
Custom sub-protocol of
See moreUIScrollViewDelegate
with additional optional callbacks.Declaration
Objective-C
@protocol PSPDFAvoidingScrollViewDelegate <UIScrollViewDelegate>
Swift
protocol AvoidingScrollViewDelegate : UIScrollViewDelegate
-
An object to handle events from a
See moreBackForwardActionList
.Declaration
Objective-C
@protocol PSPDFBackForwardActionListDelegate <NSObject>
Swift
protocol BackForwardActionListDelegate : NSObjectProtocol
-
Delegate when we use inline cell editing.
See moreDeclaration
Objective-C
@protocol PSPDFBookmarkTableViewCellDelegate <NSObject>
Swift
protocol BookmarkTableViewCellDelegate : NSObjectProtocol
-
Delegate for the bookmark controller.
See moreDeclaration
Objective-C
@protocol PSPDFBookmarkViewControllerDelegate <NSObject>
Swift
protocol BookmarkViewControllerDelegate : NSObjectProtocol
-
Delegate for signature status.
See moreDeclaration
Objective-C
@protocol PSPDFCertificatePickerViewControllerDelegate <NSObject>
Swift
protocol CertificatePickerViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFConflictResolutionManagerDelegate <NSObject> /// Invoked when the conflict resolution selection completes. /// /// The implementing object should resolve the file conflict (externally removed or modified file) using the /// selected conflict resolution option. /// /// Designed to be invoked from: `controllerForFileDeletionResolutionOnDocument:dataProvider:dataProvider:` and /// `controllerForExternalFileChangeResolutionOnDocument:dataProvider:dataProvider:`. /// /// @param manager A reference to the resolution manager that invoked this call. /// @param document The current document. /// @param dataProvider The document's data provider that detected the file change. /// @param resolution The conflict resolution option that should be performed. /// @param error An optional error describing the failure. /// @return YES, if the resolution was successful and no otherwise. - (BOOL)resolutionManager:(PSPDFConflictResolutionManager *)manager requestingFileConflictResolutionForDocument:(PSPDFDocument *)document dataProvider:(id<PSPDFCoordinatedFileDataProviding>)dataProvider withResolution:(PSPDFFileConflictResolution)resolution error:(NSError **)error; @optional /// Invoked just before the conflict resolution UI is displayed. /// /// This callback can be used to suppress UI presentation and instead perform a conflict resolution /// action immediately. /// /// @param manager A reference to the resolution manager that invoked this call. /// @param document The current document. /// @param dataProvider The document's data provider that detected the file change. /// @param type The type of conflict that is being resolved. /// @param resolution The conflict resolution option that should be performed. A default value is passed based on the conflict type. This can be modified by assigning a new value to `*resolution`. - (BOOL)resolutionManager:(PSPDFConflictResolutionManager *)manager shouldPerformAutomaticResolutionForForDocument:(PSPDFDocument *)document dataProvider:(id<PSPDFCoordinatedFileDataProviding>)dataProvider conflictType:(PSPDFFileConflictType)type resolution:(inout PSPDFFileConflictResolution *)resolution; /// Specifies the view controller that should be used for UI presentation. /// /// If not implemented or if the specified view controller is not currently being displayed, /// the topmost view controller reachable from last known window will be used to display UI during a conflict. /// /// @note Called on the main thread. /// /// @param manager A reference to the resolution manager that invoked this call. /// @return A view controller suitable for modal UI presentation. - (UIViewController *)viewControllerForPresentationForResolutionManager:(PSPDFConflictResolutionManager *)manager; @end
Swift
protocol ConflictResolutionManagerDelegate : NSObjectProtocol
-
Delegate for events and customization of
See morePSPDFContainerViewController
.Declaration
Objective-C
@protocol PSPDFContainerViewControllerDelegate <NSObject>
Swift
protocol ContainerViewControllerDelegate : NSObjectProtocol
-
Protocol for handling page changes.
See moreDeclaration
Objective-C
@protocol PSPDFPageControls <NSObject>
Swift
protocol PageControls : NSObjectProtocol
-
Protocol handling the user interface.
See moreDeclaration
Objective-C
@protocol PSPDFUserInterfaceControls <NSObject>
Swift
protocol UserInterfaceControls : NSObjectProtocol
-
Handles state changes for a given document.
See moreDeclaration
Objective-C
@protocol PSPDFControllerStateHandling <NSObject>
Swift
protocol ControllerStateHandling : NSObjectProtocol
-
Methods that need to be implemented by the
See morecoordinationDelegate
of a coordinated file data provider. As such, all methods in this protocol are required.Declaration
Objective-C
@protocol PSPDFFileCoordinationDelegate <NSObject>
Swift
protocol FileCoordinationDelegate : NSObjectProtocol
-
Delegate that can be implemented to be notified of changes that the document editor performs.
See moreDeclaration
Objective-C
@protocol PSPDFDocumentEditorDelegate <NSObject>
Swift
protocol PDFDocumentEditorDelegate : NSObjectProtocol
-
Implemented in classes that use or modify the document editor configuration.
See
e.g.PSPDFNewPageViewController
Declaration
Objective-C
@protocol PSPDFDocumentEditorConfigurationConfigurable <NSObject>
Swift
protocol PDFDocumentEditorConfigurationConfigurable : NSObjectProtocol
-
The delegate of
See morePDFDocumentEditorToolbarController
.Declaration
Objective-C
@protocol PSPDFDocumentEditorToolbarControllerDelegate < PSPDFFlexibleToolbarContainerDelegate>
Swift
protocol PDFDocumentEditorToolbarControllerDelegate : FlexibleToolbarContainerDelegate
-
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 moreDeclaration
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 moreDeclaration
Objective-C
@protocol PSPDFDocumentFeaturesObserver <NSObject>
Swift
protocol PDFDocumentFeaturesObserver : NSObjectProtocol
-
Conforming to this protocol indicated, that the view controller can be used in the document info coordinator.
See moreDeclaration
Objective-C
@protocol PSPDFDocumentInfoController
Swift
protocol DocumentInfoController
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFDocumentInfoCoordinatorDelegate<NSObject> @optional /// Notifies the delegate that the `PSPDFDocumentInfoViewController` has discarded the pending changes /// and the controller is no longer in edit mode. /// /// @param infoCoordinator The coordinator. /// @param infoViewController The `PSPDFDocumentInfoViewController` that cancelled the update. - (void)documentInfoCoordinator:(PSPDFDocumentInfoCoordinator *)infoCoordinator infoViewControllerDidCancelDocumentInfoUpdate:(PSPDFDocumentInfoViewController *)infoViewController; /// Notifies the delegate that the info view controller has applied the specified updates to the underlying document. Use this method to update the UI if required. /// /// @param infoCoordinator The coordinator. /// @param infoViewController The controller that applied the updates. - (void)documentInfoCoordinator:(PSPDFDocumentInfoCoordinator *)infoCoordinator infoViewControllerDidCommitUpdates:(PSPDFDocumentInfoViewController *)infoViewController; @end
Swift
protocol PSPDFDocumentInfoCoordinatorDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFDocumentInfoViewControllerDelegate @optional /// Notifies the delegate that the pending updates have been discarded and the controller is no longer /// in edit mode. /// /// @param infoController The `PSPDFDocumentInfoViewController` that cancelled the changes. - (void)documentInfoViewControllerDidCancelUpdates:(PSPDFDocumentInfoViewController *)infoController; /// Notifies the delegate that the updates have been applied to the underlying document. /// /// @param infoController The `PSPDFDocumentInfoViewController` that applied the changes. -(void)documentInfoViewControllerDidCommitUpdates:(PSPDFDocumentInfoViewController *)infoController; @end
Swift
protocol PSPDFDocumentInfoViewControllerDelegate
-
Document selector delegate.
See moreDeclaration
Objective-C
@protocol PSPDFDocumentPickerControllerDelegate <NSObject>
Swift
protocol PDFDocumentPickerControllerDelegate : NSObjectProtocol
-
The delegate for the
See morePDFDocumentSharingViewController
Declaration
Objective-C
@protocol PSPDFDocumentSharingViewControllerDelegate <NSObject>
Swift
protocol PDFDocumentSharingViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFDocumentViewControllerDelegate <NSObject> @optional /// Called when the spread index changes. /// /// @note This method is called even if the spread index was modified programmatically. /// /// @param documentViewController The document view controller whose spread index changed. /// @param oldSpreadIndex The old spread index, before it was changed. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didChangeSpreadIndex:(NSInteger)oldSpreadIndex; /// Called when the continuous spread index changes. /// /// @note This method is called constantly when scrolling. If you implement this method, /// it should be fast. It is called even if the continuous spread index was modified /// programmatically. /// /// @param documentViewController The document view controller whose continuous spread index changed. /// @param oldContinuousSpreadIndex The old continuous spread index, before it was changed. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didChangeContinuousSpreadIndex:(CGFloat)oldContinuousSpreadIndex; /// Called whenever the zoom scale is updated. /// /// @note This method will be called rapidly while the user is actively zooming in or out. /// Make sure you do the minimum amount of work in this method. /// /// @param documentViewController The document view controller the change occurred in. /// @param zoomScale The new zoom scale. /// @param spreadIndex The index of the spread that was zoomed or `NSNotFound` if the /// zooming view is responsible for multiple spread views. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didUpdateZoomScale:(CGFloat)zoomScale forSpreadAtIndex:(NSInteger)spreadIndex; /// Called when a spread view enters the bounds of the document view. /// /// A spread is considered visible if at least one pixel of it is inside the document /// view's bounds. /// /// @see `-documentViewController:didEndDisplayingSpreadView:forSpreadAtIndex:` /// /// @param documentViewController The document view controller the spread view belongs to. /// @param spreadView The spread view that is entering the visible bounds. /// @param spreadIndex The spread index the spread view represents. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController willBeginDisplayingSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex; /// Called when a spread view leaves the bounds of the document view. /// /// A spread is considered visible if at least one pixel of it is inside the document /// view's bounds. /// /// @see `-documentViewController:willBeginDisplayingSpreadView:forSpreadAtIndex:` /// /// @param documentViewController The document view controller the spread view belongs to. /// @param spreadView The spread view that left the visible bounds. /// @param spreadIndex The spread index the spread view represents. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didEndDisplayingSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex; /// Called when a spread view is configured and added to the view hierarchy. /// /// @see `-documentViewController:didCleanupSpreadView:forSpreadAtIndex:` /// /// @param documentViewController The document view controller the spread view belongs to. /// @param spreadView The spread view that was configured. /// @param spreadIndex The spread index the spread view represents. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didConfigureSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex; /// Called when a spread view is cleaned up and removed from the view hierarchy. /// /// @see `-documentViewController:didConfigureSpreadView:forSpreadAtIndex:` /// /// @param documentViewController The document view controller the spread view belongs to. /// @param spreadView The spread view that was cleaned up. /// @param spreadIndex The spread index the spread view represents. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didCleanupSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex; /// Called when the document view controller is configuring the scroll view that is /// responsible for scrolling the spreads. /// /// It is safe to assign a delegate to the `UIScrollView` object received in this delegate. /// /// @note This delegate method might be called multiple times throughout the lifetime /// of the scroll view. /// /// @warning Do not capture the existing scroll view delegate to relay calls - this is handled internally. /// /// @param documentViewController The document view controller the scroll view belongs to. /// @param scrollView The scroll view being configured. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController configureScrollView:(UIScrollView *)scrollView; /// Called when the document view controller is configuring a scroll view that is responsible /// for zooming one or multiple spreads. /// /// It is safe to assign a delegate to the `UIScrollView` object received in this delegate. /// /// @note This delegate method might be called multiple times throughout the lifetime /// of the scroll view. /// /// @note In some layouts the zoom view is equal to the scroll view responsible for /// scrolling the spreads. Therefore configuring the zoom view can have an impact /// on the scrolling behavior. /// /// @warning Do not capture the existing scroll view delegate to relay calls - this is handled internally. /// /// @param documentViewController The document view controller the zoom view belongs to. /// @param zoomView The zoom view being configured. /// @param spreadIndex The index of the spread the zoom view is displaying or `NSNotFound` /// if the zoom view is responsible for multiple spreads. - (void)documentViewController:(PSPDFDocumentViewController *)documentViewController configureZoomView:(UIScrollView *)zoomView forSpreadAtIndex:(NSInteger)spreadIndex; @end
Swift
protocol PDFDocumentViewControllerDelegate : NSObjectProtocol
-
Notifies of download related events.
See moreDeclaration
Objective-C
@protocol PSPDFDownloadManagerDelegate <NSObject>
Swift
protocol DownloadManagerDelegate : NSObjectProtocol
-
A delegate that is notified when the draw view begins or ends drawing a stroke. The implementation of these calls should persist the annotation changes to the document as well as recording the changes for undo.
See moreDeclaration
Objective-C
@protocol PSPDFDrawViewDelegate <NSObject>
Swift
protocol DrawViewDelegate : NSObjectProtocol
-
Delegate for the
See morePSPDFEmbeddedFilesViewController
.Declaration
Objective-C
@protocol PSPDFEmbeddedFilesViewControllerDelegate <NSObject>
Swift
protocol EmbeddedFilesViewControllerDelegate : NSObjectProtocol
-
Specifies how the eraser overlay should look and behave.
See moreDeclaration
Objective-C
@protocol PSPDFEraseOverlayDataSource <NSObject>
Swift
protocol EraseOverlayDataSource : 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 moreDeclaration
Objective-C
@protocol PSPDFExternalSignature <NSObject>
Swift
protocol ExternalSignature : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFFlexibleToolbarDelegate<NSObject> @optional /// The toolbar container will be displayed (called before `showToolbarAnimated:completion:` is performed). - (void)flexibleToolbarWillShow:(PSPDFFlexibleToolbar *)toolbar; /// The toolbar container has been displayed (called after `showToolbarAnimated:completion:` is performed). - (void)flexibleToolbarDidShow:(PSPDFFlexibleToolbar *)toolbar; /// The toolbar container will be hidden (called before `hideToolbarAnimated:completion:` is performed). - (void)flexibleToolbarWillHide:(PSPDFFlexibleToolbar *)toolbar; /// The toolbar container has been hidden (called after `hideToolbarAnimated:completion:` is performed). - (void)flexibleToolbarDidHide:(PSPDFFlexibleToolbar *)toolbar; /// Called whenever the flexible toolbar changes position in response to a user drag & drop action - (void)flexibleToolbar:(PSPDFFlexibleToolbar *)toolbar didChangePosition:(PSPDFFlexibleToolbarPosition)position; @end
Swift
protocol FlexibleToolbarDelegate : NSObjectProtocol
-
Declaration
Objective-C
@protocol PSPDFFlexibleToolbarContainerDelegate <NSObject>
Swift
protocol FlexibleToolbarContainerDelegate : NSObjectProtocol
-
Designates common
UIToolbar
orUINavigationBar
functionality.Declaration
Objective-C
@protocol PSPDFSystemBar <NSObject>
Swift
protocol SystemBar : NSObjectProtocol
-
Delegate for
See morePSPDFFontPickerViewController
, calls back when a font is selected.Declaration
Objective-C
@protocol PSPDFFontPickerViewControllerDelegate <NSObject>
Swift
protocol FontPickerViewControllerDelegate : NSObjectProtocol
-
Delegate to receive actions from the free text accessory view.
See moreDeclaration
Objective-C
@protocol PSPDFFreeTextAccessoryViewDelegate <NSObject>
Swift
protocol FreeTextAccessoryViewDelegate : NSObjectProtocol
-
Protocol for
See moreUIView
s that wish to be theloadingView
of aPSPDFGalleryContentView
.Declaration
Objective-C
@protocol PSPDFGalleryContentViewLoading <NSObject>
Swift
protocol GalleryContentViewLoading : NSObjectProtocol
-
Protocol for
See moreUIView
s that wish to be theerrorView
of aPSPDFGalleryContentView
.Declaration
Objective-C
@protocol PSPDFGalleryContentViewError <NSObject>
Swift
protocol GalleryContentViewError : NSObjectProtocol
-
Protocol for
See moreUIView
s that wish to be thecaptionView
of aPSPDFGalleryContentView
.Declaration
Objective-C
@protocol PSPDFGalleryContentViewCaption <NSObject>
Swift
protocol GalleryContentViewCaption : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFGalleryViewDataSource<NSObject> /// The number if items in a gallery. - (NSUInteger)numberOfItemsInGalleryView:(PSPDFGalleryView *)galleryView; /// The content view for the given index. - (PSPDFGalleryContentView *)galleryView:(PSPDFGalleryView *)galleryView contentViewForItemAtIndex:(NSUInteger)index; @end
Swift
protocol GalleryViewDataSource : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFGalleryViewDelegate<UIScrollViewDelegate> @optional /// Called when `currentItemIndex` changes. - (void)galleryView:(PSPDFGalleryView *)galleryView willScrollToItemAtIndex:(NSUInteger)index; - (void)galleryView:(PSPDFGalleryView *)galleryView didScrollToItemAtIndex:(NSUInteger)index; /// Called before reusing a content view. - (void)galleryView:(PSPDFGalleryView *)galleryView willReuseContentView:(PSPDFGalleryContentView *)contentView; @end
Swift
protocol GalleryViewDelegate : UIScrollViewDelegate
-
Delegate informing about image selection and editing in
See morePSPDFImagePickerController
.Declaration
Objective-C
@protocol PSPDFImagePickerControllerDelegate <NSObject>
Swift
protocol ImagePickerControllerDelegate : NSObjectProtocol
-
The delegate for the
See moreInlineSearchManager
class.Declaration
Objective-C
@protocol PSPDFInlineSearchManagerDelegate <PSPDFTextSearchDelegate>
Swift
protocol InlineSearchManagerDelegate : TextSearchDelegate
-
The delegate of a
PSPDFInstantClient
must adopt this protocol to be notified of download and authentication events.Delegates that are interested in events around the sync cycle can also implement the optional methods listed in the “Sync Events” section. For a more detailed explanation of the sync cycle of a document and its possible states, please refer to the documentation on
PSPDFInstantDocumentState
.If you need multiple observers or are only interested in the events of a single document, you can use the notifications posted by
PSPDFInstantDocumentDescriptor
.Note
Important: All methods in this protocol will be called on a background thread!Declaration
Objective-C
@protocol PSPDFInstantClientDelegate <NSObject>
Swift
protocol InstantClientDelegate : NSObjectProtocol
-
The PSPDFLibraryDataSource protocol is adopted by an object that provides the documents to be indexed by a
See morePSPDFLibrary
. 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 usingPSPDFLibraryFileSystemDataSource
, please read the documentation carefully.Declaration
Objective-C
@protocol PSPDFLibraryDataSource <NSObject>
Swift
protocol LibraryDataSource : NSObjectProtocol
-
This protocol defines a method to override the document that the
See moreLibraryFileSystemDataSource
provides to thePDFLibrary
.Declaration
Objective-C
@protocol PSPDFLibraryFileSystemDataSourceDocumentProvider <NSObject>
Swift
protocol LibraryFileSystemDataSourceDocumentProvider : NSObjectProtocol
-
Delegate for callbacks on the state of the link annotation editing container view controller.
See moreDeclaration
Objective-C
@protocol PSPDFLinkAnnotationEditingContainerViewControllerDelegate <NSObject>
Swift
protocol LinkAnnotationEditingContainerViewControllerDelegate : NSObjectProtocol
-
Protocol for delegate actions of the link annotation editing view controller.
See moreDeclaration
Objective-C
@protocol PSPDFLinkAnnotationEditingViewControllerDelegate <NSObject>
Swift
protocol LinkAnnotationEditingViewControllerDelegate : NSObjectProtocol
-
Delegate informing about state changes of the media player controller.
See moreDeclaration
Objective-C
@protocol PSPDFMediaPlayerControllerDelegate <NSObject>
Swift
protocol MediaPlayerControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFMultiDocumentListControllerDelegate<NSObject> @optional /// Informs the delegate that the user selected a document from the list. /// Typically, the presenting view controller will implement this method to dismiss the multi-document list controller. /// /// @note The multi-document list controller automatically changes the visible document of its `tabbedViewController` at the same time as calling this method. - (void)multiDocumentListController:(PSPDFMultiDocumentListController *)multiDocumentListController didSelectDocumentAtIndex:(NSUInteger)idx; /// Informs the delegate that the user tapped the cancel button in the navigation bar containing the multi-document list controller. /// By default, the multi-document list controller sets a cancel button as the `leftBarButtonItem` of its `navigationItem`. /// This method will not be called if the multi-document list controller is not inside a navigation controller. - (void)multiDocumentListControllerDidCancel:(PSPDFMultiDocumentListController *)multiDocumentListController; @end
Swift
protocol MultiDocumentListControllerDelegate : NSObjectProtocol
-
Delegate for the
See morePSPDFMultiDocumentViewController
.Declaration
Objective-C
@protocol PSPDFMultiDocumentViewControllerDelegate <NSObject>
Swift
protocol MultiDocumentViewControllerDelegate : NSObjectProtocol
-
Delegate that allows connecting a
See morePSPDFNewPageViewController
to receive the event when a selection has been chosen.Declaration
Objective-C
@protocol PSPDFNewPageViewControllerDelegate <NSObject>
Swift
protocol PDFNewPageViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFNewPageViewControllerDataSource<NSObject> @optional /// Optional method. Called when the new page view controller is being configured. /// /// The return value of this method's implementation is used to determine the correct /// title for the "Add page" button on the `PSPDFNewPageViewController` instance. /// /// @param controller The controller that's calling this method. /// /// @return Integer with the index of the first item that's selected and will serve as insertion point reference. If no index is selected, return `NSNotFound`. If this method is not implemented, `NSNotFound` is used. - (PSPDFPageIndex)selectedIndexForNewPageViewController:(PSPDFNewPageViewController *)controller; @end
Swift
protocol PDFNewPageViewControllerDataSource : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFNoteAnnotationViewControllerDelegate<NSObject> @optional /// Called when the `noteController` has deleted the parent annotation. /// Not called when any of the comments has been deleted. - (void)noteAnnotationController:(PSPDFNoteAnnotationViewController *)noteController didDeleteAnnotation:(PSPDFAnnotation *)annotation; /// Called when the `noteController` has cleared the contents of the annotation. - (void)noteAnnotationController:(PSPDFNoteAnnotationViewController *)noteController didClearContentsForAnnotation:(PSPDFAnnotation *)annotation; /// Called when the `noteController` changes the annotation’s contents, color, or iconName. - (void)noteAnnotationController:(PSPDFNoteAnnotationViewController *)noteController didChangeAnnotation:(PSPDFAnnotation *)annotation; /// Called before the `noteController` is closed. - (void)noteAnnotationController:(PSPDFNoteAnnotationViewController *)noteController willDismissWithAnnotation:(nullable PSPDFAnnotation *)annotation; @end
Swift
protocol NoteAnnotationViewControllerDelegate : NSObjectProtocol
-
The delegate of an outline cell.
See moreDeclaration
Objective-C
@protocol PSPDFOutlineCellDelegate <NSObject>
Swift
protocol OutlineCellDelegate : NSObjectProtocol
-
Delegate for the
See moreOutlineViewController
.Declaration
Objective-C
@protocol PSPDFOutlineViewControllerDelegate <NSObject>
Swift
protocol OutlineViewControllerDelegate : NSObjectProtocol
-
This protocol contains information about an image request.
See moreDeclaration
Objective-C
@protocol PSPDFPageCellImageRequestToken <NSObject>
Swift
protocol PDFPageCellImageRequestToken : NSObjectProtocol
-
This protocol is responsible for loading images and providing it to the
See morePSPDFPageCell
whenever requested by it.Declaration
Objective-C
@protocol PSPDFPageCellImageLoading <NSObject>
Swift
protocol PDFPageCellImageLoading : NSObjectProtocol
-
Handles touches of the thumbnail grid button in the page label view.
See moreDeclaration
Objective-C
@protocol PSPDFPageLabelViewDelegate <NSObject>
Swift
protocol PageLabelViewDelegate : NSObjectProtocol
-
Delegate to be notified on session begin/end and frame changes.
See moreDeclaration
Objective-C
@protocol PSPDFResizableViewDelegate <NSObject>
Swift
protocol ResizableViewDelegate : NSObjectProtocol
-
Required methods for views that represent resizable view knobs.
See moreDeclaration
Objective-C
@protocol PSPDFKnobView <NSObject>
Swift
protocol KnobView : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFSaveViewControllerDelegate<NSObject> /// Called when the done button is pressed, and the file should be saved to the selected location. /// The delegate needs to handle the actual saving process. /// /// @note This will be called with a temporary URL if `PSPDFDirectory.documentPickerDirectory` has been selected, /// to allow the document picker to move the file to the final location. You should not rely on that file to persist at the temporary location. /// /// @param controller The current save view controller. /// @param url The URL the file should be saved to, considering the current `selectedSaveDirectory`. /// @param completionHandler Call the completion handler once saving finished with the final URL the file was saved to, /// or if an error occurred before or during saving. /// If an error is provided, an alert is shown with the error's `localizedDescription` as content. - (void)saveViewController:(PSPDFSaveViewController *)controller saveFileToURL:(NSURL *)url completionHandler:(void (^)(NSURL *_Nullable url, NSError *_Nullable error))completionHandler; /// Called when the save view controller finished with a selected URL. /// This will only ever be called after the completion handler of /// `-saveViewController:saveFileToURL:completionHandler:` has been called. /// /// You should dismiss the save controller in this delegate. - (void)saveViewController:(PSPDFSaveViewController *)controller didFinishWithURL:(NSURL *)url; /// Called when the directory save view controller cancelled. /// You should dismiss the save controller in this delegate. - (void)saveViewControllerDidCancel:(PSPDFSaveViewController *)controller; @end
Swift
protocol SaveViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFScreenControllerDelegate<NSObject> @optional /// Started mirroring on `screen`. /// /// This delegate is called after the `UIWindow` has been created and the `rootViewController` is configured. /// Use this for additional customization. /// /// @note Replacing the `rootViewController` on the mirroring window is supported, /// as long as the `PDFViewController` is correctly registered as a child view controller. /// /// Use `mirrorControllerForScreen:` to access the window if required. - (void)screenController:(PSPDFScreenController *)screenController didStartMirroringForScreen:(UIScreen *)screen; /// Stopped mirroring on `screen`. /// /// This delegate is called after the mirroring window is hidden and is about to be deallocated. - (void)screenController:(PSPDFScreenController *)screenController didStopMirroringForScreen:(UIScreen *)screen; /// Implement this method to return a custom controller that should be used for mirroring. /// If you return a custom controller, ensure that it is configured correctly. /// /// This is called just before mirroring starts. /// /// @note The default implementation uses various sensible options such as /// hiding the thumbnail bar, document label and page label. It also completely mirrors the most relevant /// configuration settings of the original controller. /// /// @warning `PageTransition.scrollPerSpread` is the only supported page mode for mirroring currently. /// /// Gallery considerations: We recommend at least following options to ensure the gallery works as expected: /// `builder.allowPlayingMultipleInstances = YES;` /// `builder.usesExternalPlaybackWhileExternalScreenIsActive = NO;` /// See `galleryConfiguration` on `PDFConfiguration` for details. - (PSPDFViewController *)createPDFViewControllerForMirroring:(PSPDFScreenController *)screenController; /// This delegate can be used to decide whether the mirrored controller should copy the configuration of the original controller or not. /// /// If not implemented, defaults to YES. - (BOOL)screenController:(PSPDFScreenController *)screenController shouldSyncConfigurationTo:(PSPDFViewController *)mirroredPDFController; @end
Swift
protocol ScreenControllerDelegate : NSObjectProtocol
-
Implement this delegate to get notified of scrubber bar events.
See moreDeclaration
Objective-C
@protocol PSPDFScrubberBarDelegate <NSObject>
Swift
protocol ScrubberBarDelegate : NSObjectProtocol
-
The data source for the
See moreSearchHighlightViewManager
to coordinate animations and highlighting.Declaration
Objective-C
@protocol PSPDFSearchHighlightViewManagerDataSource <NSObject>
Swift
protocol SearchHighlightViewManagerDataSource : NSObjectProtocol
-
Protocol to integrate in a custom search result cell.
See moreDeclaration
Objective-C
@protocol PSPDFSearchResultViewable <NSObject>
Swift
protocol SearchResultViewable : NSObjectProtocol
-
Protocol to integrate in a custom header view that represents the scope of the current section.
See moreDeclaration
Objective-C
@protocol PSPDFSearchScopeViewable <NSObject>
Swift
protocol SearchScopeViewable : NSObjectProtocol
-
Protocol to integrate in a custom footer view that represents the current search status.
See moreDeclaration
Objective-C
@protocol PSPDFSearchStatusViewable <NSObject>
Swift
protocol SearchStatusViewable : NSObjectProtocol
-
Delegate for the search view controller.
Note
This is a specialization ofPSPDFTextSearchDelegate
.Declaration
Objective-C
@protocol PSPDFSearchViewControllerDelegate <PSPDFTextSearchDelegate>
Swift
protocol SearchViewControllerDelegate : TextSearchDelegate
-
Delegate for selection related events.
See moreDeclaration
Objective-C
@protocol PSPDFSelectionViewDelegate <NSObject>
Swift
protocol SelectionViewDelegate : NSObjectProtocol
-
Delegate to be notified when the
See morePSPDFSignatureSelectorViewController
has a valid selection.Declaration
Objective-C
@protocol PSPDFSignatureSelectorViewControllerDelegate <NSObject>
Swift
protocol SignatureSelectorViewControllerDelegate : NSObjectProtocol
-
Delegate to be notified on signature actions.
See moreDeclaration
Objective-C
@protocol PSPDFSignatureViewControllerDelegate <NSObject>
Swift
protocol SignatureViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFSignedFormElementViewControllerDelegate<NSObject> @optional /// Called when a signature was successfully removed from the document. - (void)signedFormElementViewController:(PSPDFSignedFormElementViewController *)controller removedSignatureFromDocument:(PSPDFDocument *)document; @end
Swift
protocol SignedFormElementViewControllerDelegate : NSObjectProtocol
-
Undocumented
See moreDeclaration
Objective-C
@protocol PSPDFStatusHUDItemDelegate - (void)statusHUDItemDidTapActionButton:(nullable PSPDFStatusHUDItem *)hudItem; @end
Swift
protocol PSPDFStatusHUDItemDelegate
-
Delegate for the
See morePDFTabbedViewController
.Declaration
Objective-C
@protocol PSPDFTabbedViewControllerDelegate <PSPDFMultiDocumentViewControllerDelegate>
Swift
protocol PDFTabbedViewControllerDelegate : MultiDocumentViewControllerDelegate
-
Search status delegate. All delegates are guaranteed to be called within the main thread.
See moreDeclaration
Objective-C
@protocol PSPDFTextSearchDelegate <NSObject>
Swift
protocol TextSearchDelegate : NSObjectProtocol
-
The delegate protocol for
See morePSPDFTextSelectionView
.Declaration
Objective-C
@protocol PSPDFTextSelectionViewDelegate <NSObject>
Swift
protocol TextSelectionViewDelegate : NSObjectProtocol
-
Delegate to be notified on actions.
See moreDeclaration
Objective-C
@protocol PSPDFTextStampViewControllerDelegate <NSObject>
Swift
protocol TextStampViewControllerDelegate : NSObjectProtocol
-
Delegate for thumbnail actions.
See moreDeclaration
Objective-C
@protocol PSPDFThumbnailBarDelegate <NSObject>
Swift
protocol ThumbnailBarDelegate : NSObjectProtocol
-
Delegate for the collection view thumbnail flow layout.
See moreDeclaration
Objective-C
@protocol PSPDFCollectionViewDelegateThumbnailFlowLayout <NSObject>
Swift
protocol CollectionViewDelegateThumbnailFlowLayout : NSObjectProtocol
-
Delegate for thumbnail actions.
See moreDeclaration
Objective-C
@protocol PSPDFThumbnailViewControllerDelegate <NSObject>
Swift
protocol ThumbnailViewControllerDelegate : NSObjectProtocol
-
Delegate for the
See morePSPDFWebViewController
to customize URL handling.Declaration
Objective-C
@protocol PSPDFWebViewControllerDelegate <PSPDFExternalURLHandler>
Swift
protocol WebViewControllerDelegate : ExternalURLHandler
-
A type that keeps track of undoable commands and works together with the system undo manager to provide the undo/redo functionality for documents.
You can use the undo controller to record new commands, and you can use the underlying undo manager to actually perform undo/redo.
Recording Commands
The undo/redo stacks contain commands that consist of one or more actions. You can add new commands to the undo stack by asking the undo controller for a recorder and using it to record multiple actions.
undoController.recordCommand(named: "Replace Annotation") { recorder in recorder.record(removing: [squareAnnotation]) { document.remove(annotations: [squareAnnotation]) } recorder.record(adding: [circleAnnotation]) { document.add(annotations: [circleAnnotation]) } }
If you want to record a new command that consists only of one type of action, you can use the convenience functions instead.
undoController.recordCommand(named: "Change Font Size", changing: [freeTextAnnotation]) { freeTextAnnotation.fontSize = 32 freeTextAnnotation.sizeToFit() }
If you want to record actions that happen asynchronously over time, you can ask the undo controller for a detached recorder instead and commit it at the end.
let recorder = undoController.beginRecordingCommand(named: "Rotate Annotation", changing: [stampAnnotation]) // Allow the user to rotate the stamp annotation. recorder.commit()
Undone commands automatically end up on the redo stack. You can’t add new commands to the redo stack yourself.
Performing Undo and Redo
The undo controller integrates with the system undo manager to provide the best and most natural undo/redo experience. Use it to check if undo/redo is possible and to perform it.
if undoController.undoManager.canUndo { undoController.undoManager.undo() }
Observing Stacks
You can observe the undo manager’s notifications if you need to respond to changes in the undo/redo stack. See the documentation of
UndoManager
for the complete list of observable notifications.PSPDF_EXPORT(PSPDFUndoController)
See moreDeclaration
Swift
@objc(PSPDFUndoController) public protocol UndoController
-
A type yielded by an undo controller that allows recording multiple undoable actions grouped as one undoable command.
PSPDF_EXPORT(PSPDFUndoRecorder)
See moreDeclaration
Swift
@objc(PSPDFUndoRecorder) public protocol UndoRecorder
-
A type of recorder that can be taken out of the scope managed by an undo controller to record undoable actions over time until manually committed.
PSPDF_EXPORT(PSPDFDetachedUndoRecorder)
See moreDeclaration
Swift
@objc(PSPDFDetachedUndoRecorder) public protocol DetachedUndoRecorder : PendingUndoRecorder, UndoRecorder
-
A type of recorder that has begun recording actions and is waiting to be manually committed.
PSPDF_EXPORT(PSPDFPendingUndoRecorder)
See moreDeclaration
Swift
@objc(PSPDFPendingUndoRecorder) public protocol PendingUndoRecorder
-
A protocol implemented by types that can store annotation sets somewhere and load them later. Annotation set stores are used for the Saved Annotations feature.
PSPDF_EXPORT(PSPDFAnnotationSetStore)
See moreDeclaration
Swift
@objc(PSPDFAnnotationSetStore) public protocol AnnotationSetStore
-
A delegate protocol of the document alignment view controller.
PSPDF_EXPORT(PSPDFDocumentAlignmentViewControllerDelegate)
See moreDeclaration
Swift
@objc(PSPDFDocumentAlignmentViewControllerDelegate) public protocol DocumentAlignmentViewControllerDelegate
-
An object that receives callbacks from a signature creation view controller.
PSPDF_EXPORT(PSPDFSignatureCreationViewControllerDelegate)
See moreDeclaration
Swift
@objc(PSPDFSignatureCreationViewControllerDelegate) public protocol SignatureCreationViewControllerDelegate : NSObjectProtocol