Class

PDFView

An object that encapsulates the functionality of PDF Kit into a single widget that you can add to your application using Interface Builder.

Declaration

iOS
class PDFView : UIView
macOS
class PDFView : NSView

Overview

PDFView may be the only class you need to deal with for adding PDF functionality to your application. It lets you display PDF data and allows users to select content, navigate through a document, set zoom level, and copy textual content to the Pasteboard. PDFView also keeps track of page history.

You can subclass PDFView to create a custom PDF viewer.

You can also create a custom PDF viewer by using the PDF Kit utility classes directly and not using PDFView at all.

Topics

Associating a Document with a View

var document: PDFDocument?

Returns the document associated with a PDFView object.

func takePasswordFrom(Any)

Unlocks with the password from the specified sender.

Deprecated

Configuring Document View

Configurations

Define display modes, scaling, rendering, printing and graphics properties.

Interacting in a View

Document Interactions

Handle selections, work with annotation actions, convert page and view points, and work with mouse events in a document.

Navigating Within a Document

var currentPage: PDFPage?

Returns the current page.

var currentDestination: PDFDestination?

Returns a PDFDestination object representing the current page and the current point in the view specified in page space.

func visiblePages() -> [PDFPage]

Returns an array of PDFPage objects that represent the currently visible pages.

Navigation

Operations for moving through page history and seeking to a page in a document.

Setting the Delegate

var delegate: PDFViewDelegate?

Returns the view’s delegate.

protocol PDFViewDelegate

The delegate for the PDFView object.

Notifications

A PDFView object posts the following notifications:

static let PDFViewChangedHistory: NSNotification.Name

A notification posted when the page history changes.

static let PDFViewDocumentChanged: NSNotification.Name

A notification posted when a new document is associated with the view.

static let PDFViewPageChanged: NSNotification.Name

A notification posted when a new page becomes the current page.

static let PDFViewScaleChanged: NSNotification.Name

A notification posted when the scale factor changes.

static let PDFViewAnnotationHit: NSNotification.Name

A notification posted when the user clicks on an annotation.

static let PDFViewCopyPermission: NSNotification.Name

A notification posted when the user attempts to copy to the pasteboard without the appropriate permissions.

static let PDFViewPrintPermission: NSNotification.Name

A notification posted when the user attempts to print without the appropriate permissions.

static let PDFViewAnnotationWillHit: NSNotification.Name

A notification posted before the user clicks an annotation.

static let PDFViewSelectionChanged: NSNotification.Name

A notification posted when the current selection has changed.

static let PDFViewDisplayModeChanged: NSNotification.Name

A notification posted when the display mode has changed.

static let PDFViewDisplayBoxChanged: NSNotification.Name

A notification posted when the display box has changed.

static let PDFViewVisiblePagesChanged: NSNotification.Name

A notification posted when the visible pages have changed.

Instance Properties

See Also

Views

class PDFThumbnailView

A PDFThumbnailView object contains a set of thumbnails, each of which represents a page in a PDF document.