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:(PSPDFPageIndex)pageIndex animated:(BOOL)animated;

    Swift

    func reloadPage(at pageIndex: PageIndex, 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.

  • The index of the current page.

    If there is more than one page displayed, the getter returns the index of the first page in the spread that is in the center of the viewport. With PSPDFPageTransitionScrollPerSpread (displaying a single spread), this will be the lowest visible page index. With PSPDFPageTransitionScrollContinuous this will be the index of the page in the center of the viewport.

    More advanced APIs to handle spread transitions and other document view mode related APIs are available through PSPDFDocumentViewController. In particular, these may be useful: documentViewController.visibleSpreadViews, PSPDFSpreadView’s spreadIndex property, and documentViewController.layout.pageRangeForSpread(at spreadIndex).

    See

    -documentViewController

    Declaration

    Objective-C

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

    Swift

    var pageIndex: PageIndex { 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:(PSPDFPageIndex)pageIndex animated:(BOOL)animated;

    Swift

    func setPageIndex(_ pageIndex: PageIndex, 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.

    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 }
  • 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:(PSPDFPageIndex)pageIndex
                    animated:(BOOL)animated
             actionContainer:(nullable id)actionContainer;

    Swift

    func execute(_ action: PSPDFAction?, targetRect: CGRect, pageIndex: PageIndex, 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 show(animated: Bool) -> Bool
  • Hide the User Interface. Respects UserInterfaceViewMode.

    Declaration

    Objective-C

    - (BOOL)hideControlsAnimated:(BOOL)animated;

    Swift

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

    Declaration

    Objective-C

    - (BOOL)hideControlsAndPageElementsAnimated:(BOOL)animated;

    Swift

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

    Declaration

    Objective-C

    - (BOOL)toggleControlsAnimated:(BOOL)animated;

    Swift

    func toggle(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;

    Swift

    var overlayViewController: (UIViewController & PSPDFControllerStateHandling)? { get set }
  • 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.

    Note

    This will only scroll inside the current page when using page curl transitions.

    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:(PSPDFPageIndex)pageIndex;

    Swift

    func pageViewForPage(at pageIndex: PageIndex) -> 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: (PSPDFConfigurationBuilder) -> Void)
  • Updates the configuration without triggering a view reload.

    See

    updateConfigurationWithBuilder: for a better alternative.

    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. The benefit is that this method does not trigger a reload and thus is faster. As a general rule, any property that chnanges the view hierarchy will require an explicit update.

    Changes in PSPDFKit might result in differences around explicit/implicit updating. A property which was picked up before might no longer be updated automatically with an update. Makes sure to test calls to this option whenever you attempt a version update.

    Declaration

    Objective-C

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

    Swift

    func updateConfigurationWithoutReloading(builder builderBlock: (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;
  • 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;
  • 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;
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • Toggles between the document and the thumbnails view state (PSPDFViewModeThumbnails).

    See

    setViewMode:animated:

    Declaration

    Objective-C

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

    Swift

    var thumbnailsButtonItem: UIBarButtonItem { get }
  • Toggles between the document and the document editor view state (PSPDFViewModeDocumentEditor).

    Note

    Requires the Document Editor component to be enabled for your license.

    See

    setViewMode:animated:

    Declaration

    Objective-C

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

    Swift

    var documentEditorButtonItem: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • 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: UIBarButtonItem { get }
  • Presents the PSPDFSettingsViewContoller to control some aspects of PSPDFViewController UX.

    Declaration

    Objective-C

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

    Swift

    var settingsButtonItem: UIBarButtonItem { get }
  • 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: [UIBarButtonItem] { get set }
  • 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?)