PSPDFViewController

This is the main view controller to display PDF documents.

This view controller can be used modally or embedded in another view controller.

Note

When adding as a child view controller, ensure view controller containment is set up correctly. If you override this class, ensure all UIViewController methods you’re using do call super. https://pspdfkit.com/guides/ios/current/customizing-the-interface/embedding-the-pspdfviewcontroller-inside-a-custom-container-view-controller/

For subclassing, use overrideClass:withClass: to register your custom subclasses. https://pspdfkit.com/guides/ios/current/getting-started/overriding-classes/

The best time for setting properties is during initialization in commonInitWithDocument:configuration:. Some properties require a call to reloadData if they are changed after the controller has been displayed. Do not set properties during a rotation phase or view appearance (e.g. use viewDidAppear: instead of viewWillAppear:) since that could corrupt internal state, instead use updateSettingsForBoundsChangeBlock.

  • Initialize with a document. - note: Document can be nil. In this case, just the background is displayed and the User Interface stays visible. Also supports creation via initWithCoder: to allow usage in Storyboards.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDocument:(nullable PSPDFDocument *)document
                               configuration:
                                   (nullable PSPDFConfiguration *)configuration;

    Swift

    init(document: PSPDFDocument?, configuration: PSPDFConfiguration?)
  • Convenience init for initWithDocument:configuration: that uses a default configuration set.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDocument:(nullable PSPDFDocument *)document;

    Swift

    convenience init(document: PSPDFDocument?)
  • Property for the currently displayed document. - note: To allow easier setup via Storyboards, this property also accepts NSStrings. (The default bundle path will be used.)

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) PSPDFDocument *document;

    Swift

    var document: PSPDFDocument? { get set }
  • The document view controller displaying the current document.

    The documentViewController is a child view controller of PSPDFViewController. It is responsible for the main document content view, shown when the view controller is in PSPDFViewModeDocument.

    Note

    This returns nil if document is nil or invalid.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        PSPDFDocumentViewController *documentViewController;

    Swift

    var documentViewController: PSPDFDocumentViewController? { get }
  • Register delegate to capture events, change properties.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFViewControllerDelegate> _Nullable delegate;
  • Register to be informed of and direct form submissions.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFFormSubmissionDelegate> _Nullable formSubmissionDelegate;
  • Reloads the view hierarchy and triggers a re-render of the document. This method is required to be called after most changed settings. Certain setters like changing a document will trigger this implcitely.

    If possible (= the document has not changed significantly) this will preserve: - The current view state (page and scrolling position) - Selected annotations

    Note

    This is called implicitly with updateConfigurationWithBuilder:.

    To reset the view port, call applyViewState:animateIfPossible: with a view state that only offers a page and not a specific view port: [[PSPDFViewState alloc] initWithPageIndex:pageIndex]

    Declaration

    Objective-C

    - (void)reloadData;

    Swift

    @IBAction func reloadData()
  • Reloads the view hierarchy and triggers a re-render of a specific page.

    Annotation selection will be cleared.

    Declaration

    Objective-C

    - (void)reloadPageAtIndex:(NSUInteger)pageIndex animated:(BOOL)animated;

    Swift

    func reloadPage(at pageIndex: UInt, animated: Bool)

    Parameters

    pageIndex

    The index of the page in the document to be reloaded. Page indexes start at 0.

    animated

    Whether to animate the view updates.

  • Represents the current page. If there is more than one page displayed, the getter will always return the lowest visible page index.

    More advanced APIs to handle spread transitions and other document view mode related APIs are available through PSPDFDocumentViewController.

    See

    -documentViewController

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger pageIndex;

    Swift

    var pageIndex: UInt { get set }
  • Sets the current page while optionally animating the change.

    More advanced APIs to handle spread transitions and other document view mode related APIs are available through PSPDFDocumentViewController.

    See

    -documentViewController

    Declaration

    Objective-C

    - (void)setPageIndex:(NSUInteger)pageIndex animated:(BOOL)animated;

    Swift

    func setPageIndex(_ pageIndex: UInt, animated: Bool)

    Parameters

    pageIndex

    The page to transition to.

    animated

    YES if the transition should be animated, NO otherwise.

  • Captures the current view–state of the receiver as a serializable object. - note: There may not always be a view–state to capture. Reasons for this include the view not being loaded yet, no document being set, etc. As a rule of thumb, you should only expect to obtain a nonnull value after viewDidAppear: and before viewWillDisappear: has been called.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) PSPDFViewState *viewState;

    Swift

    var viewState: PSPDFViewState? { get }
  • Applies a previously captured view state, optionally animated. - parameter: viewState The state to restore. - parameter: animateIfPossible A hint whether applying the state should be animated. @discussion It is not always possible to animate application of a new view state: Animation only ever happens if the view controller is currently on screen. Therefore, a YES value may be silently ignored. A word on timing: The most common use–case for this method is to seamlessly restore the reading position in a document when displaying the receiver. However, since restoring a viewport requires a fairly complete view hierarchy, you should not try to call this method directly after init. If you subclass PSPDFViewController, viewWillAppear: and viewDidLayoutSubviews (after calling super) are good times to do so. - note: For PSPDFPageTransitionCurl, only the page is being restored.

    Declaration

    Objective-C

    - (void)applyViewState:(nonnull PSPDFViewState *)viewState
         animateIfPossible:(BOOL)animateIfPossible;

    Swift

    func applyViewState(_ viewState: PSPDFViewState, animateIfPossible: Bool)

    Parameters

    viewState

    The state to restore.

    animateIfPossible

    A hint whether applying the state should be animated.

  • Searches for searchText within the current document. Opens the PSPDFSearchViewController, or presents inline search UI based searchMode in PSPDFConfiguration. If searchText is nil, the UI is shown but no search is performed. The only valid option is PSPDFViewControllerSearchHeadlessKey to disable the search UI. options are also passed through to the presentViewController:options:animated:sender:completion: method. sender is used to anchor the search popover, if one should be displayed (see searchMode in PSPDFConfiguration).

    Declaration

    Objective-C

    - (void)searchForString:(nullable NSString *)searchText
                    options:(nullable NSDictionary<NSString *, id> *)options
                     sender:(nullable id)sender
                   animated:(BOOL)animated;

    Swift

    func search(for searchText: String?, options: [String : Any]? = nil, sender: Any?, animated: Bool)
  • Cancels search and hides search UI.

    Declaration

    Objective-C

    - (void)cancelSearchAnimated:(BOOL)animated;

    Swift

    func cancelSearch(animated: Bool)
  • Returns YES if a search UI is currently being presented.

    Declaration

    Objective-C

    @property (readonly, getter=isSearchActive, nonatomic) BOOL searchActive;

    Swift

    var isSearchActive: Bool { get }
  • The search view manager

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFSearchHighlightViewManager *_Nonnull searchHighlightViewManager;

    Swift

    var searchHighlightViewManager: PSPDFSearchHighlightViewManager { get }
  • The inline search manager used when PSPDFSearchModeInline is set.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFInlineSearchManager *_Nonnull inlineSearchManager;

    Swift

    var inlineSearchManager: PSPDFInlineSearchManager { get }
  • The appearance manager, responsible for the rendering style and app theme.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFAppearanceModeManager *_Nonnull appearanceModeManager;

    Swift

    var appearanceModeManager: PSPDFAppearanceModeManager { get }
  • The brightness manager, responsible for controlling screen brightness.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFBrightnessManager *_Nonnull brightnessManager;
  • Text extraction class for current document. The delegate is set to this controller. Don’t change but create your own text search class instead if you need a different delegate. - note: Will be recreated as the document changes. Returns nil if the document is nil. Thread safe.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFTextSearch *_Nonnull textSearch;

    Swift

    var textSearch: PSPDFTextSearch { get }
  • Executes a PDF action. actionContainer is the object that provides the action (usually an annotation). Can be nil.

    Declaration

    Objective-C

    - (BOOL)executePDFAction:(nullable PSPDFAction *)action
                  targetRect:(CGRect)targetRect
                   pageIndex:(NSUInteger)pageIndex
                    animated:(BOOL)animated
             actionContainer:(nullable id)actionContainer;

    Swift

    func execute(_ action: PSPDFAction?, targetRect: CGRect, pageIndex: UInt, animated: Bool, actionContainer: Any?) -> Bool
  • Represents previously invoked PDF actions and allows navigation through the action history. - note: You need to manually update this list if you’re executing actions outside of the controller executePDFAction:targetRect:page:page:actionContainer: (i.e., using PSPDFActionExecutor directly).

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFBackForwardActionList *_Nonnull backForwardList;

    Swift

    var backForwardList: PSPDFBackForwardActionList { get }
  • View that is displayed as User Interface.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFUserInterfaceView *_Nonnull userInterfaceView;

    Swift

    var userInterfaceView: PSPDFUserInterfaceView { get }
  • Show or hide User Interface controls, titlebar, status bar (depending on the appearance properties).

    Declaration

    Objective-C

    @property (getter=isUserInterfaceVisible, assign, readwrite, nonatomic)
        BOOL userInterfaceVisible;

    Swift

    var isUserInterfaceVisible: Bool { get set }
  • Show or hide User Interface controls. optionally animated.

    Declaration

    Objective-C

    - (BOOL)setUserInterfaceVisible:(BOOL)show animated:(BOOL)animated;

    Swift

    func setUserInterfaceVisible(_ show: Bool, animated: Bool) -> Bool
  • Show the User Interface. Respects UserInterfaceViewMode.

    Declaration

    Objective-C

    - (BOOL)showControlsAnimated:(BOOL)animated;

    Swift

    func showControls(animated: Bool) -> Bool
  • Hide the User Interface. Respects UserInterfaceViewMode.

    Declaration

    Objective-C

    - (BOOL)hideControlsAnimated:(BOOL)animated;

    Swift

    func hideControls(animated: Bool) -> Bool
  • Hide the User Interface (respects UserInterfaceViewMode) and additional elements like page selection.

    Declaration

    Objective-C

    - (BOOL)hideControlsAndPageElementsAnimated:(BOOL)animated;

    Swift

    func hideControlsAndPageElements(animated: Bool) -> Bool
  • Toggles the User Interface. Respects UserInterfaceViewMode.

    Declaration

    Objective-C

    - (BOOL)toggleControlsAnimated:(BOOL)animated;

    Swift

    func toggleControls(animated: Bool) -> Bool
  • Content view. Use this if you want to add any always-visible UI elements. ContentView does NOT overlay the navigationBar/statusBar, even if that one is transparent.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFRelayTouchesView *_Nonnull contentView;

    Swift

    var contentView: PSPDFRelayTouchesView { get }
  • Check this to determine the navigation bar visibility when it is managed by PSPDFKit. Will return the same value as navigationController.navigationBarHidden if shouldHideNavigationBarWithUserInterface is not set or userInterfaceViewMode is set to PSPDFUserInterfaceViewModeAlways. - note: PSPDFKit always sets navigationController.navigationBarHidden to NO when managing navigation bar visibility.

    Declaration

    Objective-C

    @property (readonly, getter=isNavigationBarHidden, nonatomic)
        BOOL navigationBarHidden;

    Swift

    var isNavigationBarHidden: Bool { get }
  • The controller state that this view controller is currently in.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFControllerState controllerState;

    Swift

    var controllerState: PSPDFControllerState { get }
  • If controllerState equals PSPDFControllerStateError or PSPDFControllerStateLocked, contains the underlying error.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSError *controllerStateError;

    Swift

    var controllerStateError: Error? { get }
  • The view controller that is used to present the current controller state overlay of the PSPDFViewController.

    Setting the overlay view controller makes it a child view controller of the receiver.

    Note

    The default value for this property is an internal view controller that is used to visualize the state. Only set this property if you want to take care of state handling yourself.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        UIViewController<PSPDFControllerStateHandling> *overlayViewController;
  • The page grabber controller is used to configure a page grabber, a small view shown in the view controller to quickly skim through the pages of a document.

    The getter returns nil if isPageGrabberEnabled is set to NO in the configuration.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        PSPDFPageGrabberController *pageGrabberController;

    Swift

    var pageGrabberController: PSPDFPageGrabberController? { get }
  • Return the pageView for a given page. Returns nil if page is not Initialized (e.g. page is not visible.) Usually, using the delegates is a better idea to get the current page.

    Declaration

    Objective-C

    - (nullable PSPDFPageView *)pageViewForPageAtIndex:(NSUInteger)pageIndex;

    Swift

    func pageViewForPage(at pageIndex: UInt) -> PSPDFPageView?
  • Return array of all currently visible PSPDFPageView objects.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSArray<PSPDFPageView *> *_Nonnull visiblePageViews;

    Swift

    var visiblePageViews: [PSPDFPageView] { get }
  • Called when viewWillLayoutSubviews is triggered. - note: You can use this to adapt to view frame changes (i.e., add or remove toolbar items). Check pdfController.traitCollection and act accordingly.

    Declaration

    Objective-C

    - (void)setUpdateSettingsForBoundsChangeBlock:
        (nonnull void (^)(PSPDFViewController *_Nonnull))block;

    Swift

    func setUpdateSettingsForBoundsChange(_ block: @escaping (PSPDFViewController) -> Void)
  • The configuration. Defaults to +PSPDFConfiguration.defaultConfiguration. - warning: You cannot set this property to nil since the pdf controller must always have a configuration.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) PSPDFConfiguration *_Nonnull configuration;

    Swift

    @NSCopying var configuration: PSPDFConfiguration { get }
  • Changes any value within PSPDFConfiguration and correctly updates the state in the controller. - note: This will invoke reloadData to apply the changes, which will reset the zoom level back to 1.0.

    Declaration

    Objective-C

    - (void)updateConfigurationWithBuilder:
        (nonnull void (^)(PSPDFConfigurationBuilder *_Nonnull))builderBlock;

    Swift

    func updateConfiguration(builder builderBlock: @escaping (PSPDFConfigurationBuilder) -> Void)
  • Updates the configuration without triggering a reload. - warning: You should know what you’re doing with using this updater. The PSPDFViewController will not be reloaded, which can bring it into a invalid state. Use this for properties that don’t require reloading such as textSelectionEnabled or scrollOnTapPageEndEnabled.

    Declaration

    Objective-C

    - (void)updateConfigurationWithoutReloadingWithBuilder:
        (nonnull void (^)(PSPDFConfigurationBuilder *_Nonnull))builderBlock;

    Swift

    func updateConfigurationWithoutReloading(builder builderBlock: @escaping (PSPDFConfigurationBuilder) -> Void)
  • Show a modal view controller or a popover with automatically added close button on the left side. Use sender (UIBarButtonItem or UIView) OR rect in options (both only needed for the popover) - note: If this returns NO, the completion block won’t be called and presentation was blocked.

    Declaration

    Objective-C

    - (BOOL)presentViewController:(nonnull UIViewController *)controller
                          options:(nullable NSDictionary<NSString *, id> *)options
                         animated:(BOOL)animated
                           sender:(nullable id)sender
                       completion:(nullable void (^)(void))completion;

    Swift

    func present(_ controller: Any!, options: [String : Any]? = nil, animated: Bool, sender: Any?, completion: (() -> Void)? = nil) -> Bool
  • Dismisses a view controller or popover controller, if class matches.

    Declaration

    Objective-C

    - (BOOL)dismissViewControllerOfClass:(nullable Class)controllerClass
                                animated:(BOOL)animated
                              completion:(nullable void (^)(void))completion;

    Swift

    func dismiss(of controllerClass: AnyClass?, animated: Bool, completion: (() -> Void)? = nil) -> Bool
  • Invoked when a document action wants to present a new document modally. Can be subclassed to change behavior.

    Declaration

    Objective-C

    - (void)
    presentPDFViewControllerWithDocument:(nonnull PSPDFDocument *)document
                                 options:(nullable NSDictionary<NSString *, id> *)
                                             options
                                  sender:(nullable id)sender
                                animated:(BOOL)animated
                      configurationBlock:
                          (nullable void (^)(PSPDFViewController *_Nonnull))
                              configurationBlock
                              completion:(nullable void (^)(void))completion;

    Swift

    func present(with document: PSPDFDocument, options: [String : Any]? = nil, sender: Any?, animated: Bool, configurationBlock: ((PSPDFViewController) -> Void)?, completion: (() -> Void)? = nil)
  • Allows file preview using QuickLook. Will call presentPDFViewControllerWithDocument: if the pdf filetype is detected.

    Declaration

    Objective-C

    - (void)
    presentPreviewControllerForURL:(nonnull NSURL *)fileURL
                             title:(nullable NSString *)title
                           options:(nullable NSDictionary<NSString *, id> *)options
                            sender:(nullable id)sender
                          animated:(BOOL)animated
                        completion:(nullable void (^)(void))completion;

    Swift

    func presentPreviewController(for fileURL: URL, title: String?, options: [String : Any]? = nil, sender: Any?, animated: Bool, completion: (() -> Void)? = nil)
  • Preconfigures the activity view controller for a certain sender.

    Declaration

    Objective-C

    - (nullable UIActivityViewController *)activityViewControllerWithSender:
        (nonnull id)sender;

    Swift

    func activityViewControllerWithSender(_ sender: Any) -> Any!

    Parameters

    sender

    can be a bar button item, a view or a boxed rect.

    Return Value

    A preconfigured activity view controller subclass or nil if the document is nil.

  • Use this if you want to customize the navigation bar appearance of a PSPDFViewController. - note: This creates a navigationItem on demand, only call this method if you need it.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFNavigationItem *_Nonnull navigationItem;

    Swift

    var navigationItem: PSPDFNavigationItem { get }
  • Default button in leftBarButtonItems if view is presented modally.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull closeButtonItem;

    Swift

    var closeButtonItem: UnsafeMutablePointer
  • Presents the PSPDFOutlineViewController if there is an outline defined in the PDF. - note: Also available as activity via PSPDFActivityTypeOutline.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull outlineButtonItem;

    Swift

    var outlineButtonItem: UnsafeMutablePointer
  • Presents the PSPDFSearchViewController or the PSPDFInlineSearchManager for searching text in the current document. - see: PSPDFSearchMode in PSPDFConfiguration to configure this. - note: Also available as activity via PSPDFActivityTypeSearch.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull searchButtonItem;

    Swift

    var searchButtonItem: UnsafeMutablePointer
  • Toggles between the document and the thumbnails view state (PSPDFViewModeThumbnails). - see: PSPDFViewMode - see: setViewMode:animated:

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull thumbnailsButtonItem;

    Swift

    var thumbnailsButtonItem: UnsafeMutablePointer
  • Toggles between the document and the document editor view state (PSPDFViewModeDocumentEditor). - note: Requires the Document Editor component to be enabled for your license. - see: PSPDFViewMode - see: setViewMode:animated:

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        UIBarButtonItem *_Nonnull documentEditorButtonItem;

    Swift

    var documentEditorButtonItem: UnsafeMutablePointer
  • Presents the UIPrintInteractionController for document printing. - note: Only displayed if document is allowed to be printed (see allowsPrinting in PSPDFDocument) - note: You should use the activityButtonItem instead (UIActivityTypePrint).

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull printButtonItem;

    Swift

    var printButtonItem: UnsafeMutablePointer
  • Presents the UIDocumentInteractionController controller to open documents in other apps. - note: You should use the activityButtonItem instead (PSPDFActivityTypeOpenIn).

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull openInButtonItem;

    Swift

    var openInButtonItem: UnsafeMutablePointer
  • Presents the MFMailComposeViewController to send the document via email. - note: Will only work when sending emails is configured on the device. - note: You should use the activityButtonItem instead (UIActivityTypeMail).

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull emailButtonItem;

    Swift

    var emailButtonItem: UnsafeMutablePointer
  • Presents the MFMessageComposeViewController to send the document via SMS/iMessage. - note: Will only work if iMessage or SMS is configured on the device. - note: You should use the activityButtonItem instead (UIActivityTypeMessage).

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull messageButtonItem;

    Swift

    var messageButtonItem: UnsafeMutablePointer
  • Shows and hides the PSPDFAnnotationToolbar toolbar for creating annotations. - note: Requires the PSPDFFeatureMaskAnnotationEditing feature flag.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull annotationButtonItem;

    Swift

    var annotationButtonItem: UnsafeMutablePointer
  • Presents the PSPDFBookmarkViewController for creating/editing/viewing bookmarks. - note: Also available as activity via PSPDFActivityTypeBookmarks.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull bookmarkButtonItem;

    Swift

    var bookmarkButtonItem: UnsafeMutablePointer
  • Presents the PSPDFBrightnessViewController to control screen brightness. - note: iOS has a similar feature in the control center, but PSPDFKit brightness includes an additional software brightener.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull brightnessButtonItem;

    Swift

    var brightnessButtonItem: UnsafeMutablePointer
  • Presents the UIActivityViewController for various actions, including many of the above button items.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull activityButtonItem;

    Swift

    var activityButtonItem: UnsafeMutablePointer
  • Presents the PSPDFSettingsViewContoller to control some aspects of PSPDFViewController UX.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBarButtonItem *_Nonnull settingsButtonItem;

    Swift

    var settingsButtonItem: UnsafeMutablePointer
  • Add your custom UIBarButtonItems so that they won’t be automatically enabled/disabled. - warning: This needs to be set before setting left/rightBarButtonItems.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSArray<UIBarButtonItem *> *_Nonnull barButtonItemsAlwaysEnabled;

    Swift

    var barButtonItemsAlwaysEnabled: [Any] { get set }
  • Handler for all document related actions.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFDocumentActionExecutor *_Nonnull documentActionExecutor;

    Swift

    var documentActionExecutor: PSPDFDocumentActionExecutor { get }
  • Handles the controllers for metadata infos (outline, annotations, bookmarks, embedded files)

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        PSPDFDocumentInfoCoordinator *_Nonnull documentInfoCoordinator;

    Swift

    var documentInfoCoordinator: PSPDFDocumentInfoCoordinator { get }
  • Accesses and manages the annotation toolbar. To check if the toolbar is visible, check if a window is set on the toolbar.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        PSPDFAnnotationToolbarController *annotationToolbarController;

    Swift

    var annotationToolbarController: PSPDFAnnotationToolbarController? { get }
  • Override this initializer to allow all use cases (storyboard loading, etc) - warning: Do not call this method directly, except for calling super when overriding it.

    Declaration

    Objective-C

    - (void)commonInitWithDocument:(nullable PSPDFDocument *)document
                     configuration:(nonnull PSPDFConfiguration *)configuration;

    Swift

    func commonInit(with document: PSPDFDocument?, configuration: PSPDFConfiguration)
  • Called when a document view controller has been created.

    A document view controller may be created and destroyed multiple times through out the lifetime of a PSPDFViewController, depending on the document being set and its state.

    You can implement this method to customize a document view controller’s appearance.

    Declaration

    Objective-C

    - (void)documentViewControllerDidLoad;

    Swift

    func documentViewControllerDidLoad()
  • Override if you’re changing the toolbar to your own. The toolbar is only displayed, if PSPDFViewController is inside a UINavigationController.

    Declaration

    Objective-C

    - (void)updateToolbarAnimated:(BOOL)animated;

    Swift

    func updateToolbar(animated: Bool)
  • Return rect of the content view area excluding translucent toolbar/status bar. - note: This method does not compensate for the navigation bar alone. Returns the view bounds when the view controller is not visible.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGRect contentRect;

    Swift

    var contentRect: CGRect { get }
  • Bar Button Actions

    Declaration

    Objective-C

    - (void)annotationButtonPressed:(nullable id)sender;

    Swift

    func annotationButtonPressed(_ sender: Any?)