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 HUD 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 }
  • 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()
  • Set current page. Page starts at 0.

    Declaration

    Objective-C

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

    Swift

    var pageIndex: UInt { get set }
  • Set current page, optionally animated. Page starts at 0. Returns NO if page is invalid (e.g. out of bounds). If the document is currently locked, this method returns NO and page property remains 0. The set page value is however preserved internally and restored when the controller reloads after the document is unlocked. - note: The transition will only be animated if the destination page is close to the current page (less than 3 pages away), even if animated is set to YES.

    Declaration

    Objective-C

    - (BOOL)setPageIndex:(NSUInteger)pageIndex animated:(BOOL)animated;
  • Scroll to next page. Will potentially advance two pages in dualPage mode.

    Declaration

    Objective-C

    - (BOOL)scrollToNextPageAnimated:(BOOL)animated;

    Swift

    func scrollToNextPage(animated: Bool) -> Bool
  • Scroll to previous page. Will potentially decrease two pages in dualPage mode.

    Declaration

    Objective-C

    - (BOOL)scrollToPreviousPageAnimated:(BOOL)animated;

    Swift

    func scrollToPreviousPage(animated: Bool) -> Bool
  • Enable/disable scrolling. Can be used in special cases where scrolling is turned off (temporarily). Defaults to YES.

    Declaration

    Objective-C

    @property (getter=isScrollingEnabled, assign, readwrite, nonatomic)
        BOOL scrollingEnabled;

    Swift

    var isScrollingEnabled: Bool { get set }
  • Locks the view. Disables scrolling, zooming and gestures that would invoke scrolling/zooming. Also blocks programmatically calls to scrollToPage. This is useful if you want to invoke a drawing mode. (e.g. Ink Annotation drawing) - warning: This might be disabled after a reloadData.

    Declaration

    Objective-C

    @property (getter=isViewLockEnabled, assign, readwrite, nonatomic)
        BOOL viewLockEnabled;

    Swift

    var isViewLockEnabled: Bool { get set }
  • Scrolls to a specific rect on the current page. - note: rect is in screen coordinate space. If you want to use PDF coordinates, convert them via: PSPDFConvertPDFRectToViewRect() or -convertPDFPointToViewPoint: of PSPDFPageView.

    Declaration

    Objective-C

    - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;

    Swift

    func scrollRectToVisible(_ rect: CGRect, animated: Bool)
  • Zooms to a specific view rect, optionally animated.

    Declaration

    Objective-C

    - (void)zoomToRect:(CGRect)rect
             pageIndex:(NSUInteger)pageIndex
              animated:(BOOL)animated;

    Swift

    func zoom(to rect: CGRect, pageIndex: UInt, animated: Bool)
  • Zoom to specific scale, optionally animated.

    Declaration

    Objective-C

    - (void)setZoomScale:(CGFloat)scale animated:(BOOL)animated;

    Swift

    func setZoomScale(_ scale: CGFloat, animated: Bool)
  • Declaration

    Objective-C

    - (nullable PSPDFViewState *)captureCurrentViewState;

    Swift

    func captureCurrentViewState() -> PSPDFViewState?
  • 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 apply(_ 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;

    Swift

    var brightnessManager: PSPDFBrightnessManager { 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:(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 HUD.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFHUDView *_Nonnull HUDView;

    Swift

    var hudView: PSPDFHUDView { get }
  • Show or hide HUD controls, titlebar, status bar (depending on the appearance properties).

    Declaration

    Objective-C

    @property (getter=isHUDVisible, assign, readwrite, nonatomic) BOOL HUDVisible;

    Swift

    var isHUDVisible: Bool { get set }
  • Show or hide HUD controls. optionally animated.

    Declaration

    Objective-C

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

    Swift

    func setHUDVisible(_ show: Bool, animated: Bool) -> Bool
  • Show the HUD. Respects HUDViewMode.

    Declaration

    Objective-C

    - (BOOL)showControlsAnimated:(BOOL)animated;

    Swift

    func show(animated: Bool) -> Bool
  • Hide the HUD. Respects HUDViewMode.

    Declaration

    Objective-C

    - (BOOL)hideControlsAnimated:(BOOL)animated;

    Swift

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

    Declaration

    Objective-C

    - (BOOL)hideControlsAndPageElementsAnimated:(BOOL)animated;

    Swift

    func hideAndPageElements(animated: Bool) -> Bool
  • Toggles the HUD. Respects HUDViewMode.

    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 shouldHideNavigationBarWithHUD is not set or HUDViewMode is set to PSPDFHUDViewModeAlways. - 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 the 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? { 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.

    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?
  • Paging scroll view. (hosts scroll views for PDF) If you want to customize this, override reloadData and set the properties after calling super.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) UIScrollView *pagingScrollView;

    Swift

    var pagingScrollView: UIScrollView? { get }
  • Return an NSNumber-Array of currently visible page numbers. - warning: This might return more numbers than actually visible if it’s queried during a scroll animation.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSOrderedSet<NSNumber *> *_Nonnull visiblePageIndexes;

    Swift

    var visiblePageIndexes: NSOrderedSet { get }
  • Return array of all currently visible PSPDFPageView objects.

    Declaration

    Objective-C

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

    Swift

    var visiblePageViews: [PSPDFPageView] { get }
  • Depending on pageMode, this returns true if two pages are displayed.

    Declaration

    Objective-C

    @property (readonly, getter=isDoublePageMode, nonatomic) BOOL doublePageMode;

    Swift

    var isDoublePageMode: Bool { get }
  • Returns YES if the document is at the last page.

    Declaration

    Objective-C

    @property (readonly, getter=isLastPage, nonatomic) BOOL lastPage;

    Swift

    var isLastPage: Bool { get }
  • Returns YES if the document is at the first page.

    Declaration

    Objective-C

    @property (readonly, getter=isFirstPage, nonatomic) BOOL firstPage;

    Swift

    var isFirstPage: Bool { 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 }
  • Allows to change 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)
  • Allows to update 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: UIViewController, 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 dismissViewController(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) -> UIActivityViewController?

    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: 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: PSPDFViewMode - 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: PSPDFViewMode - 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 }
  • 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)
  • 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 }
  • Reload a specific page.

    Declaration

    Objective-C

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

    Swift

    func updatepageIndex(_ pageIndex: UInt, animated: Bool)
  • Bar Button Actions

    Declaration

    Objective-C

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

    Swift

    func annotationButtonPressed(_ sender: Any?)