Class

PDFDocument

An object that represents PDF data or a PDF file and defines methods for writing, searching, and selecting PDF data.

Overview

The other utility classes are either instantiated from methods in PDFDocument, as are PDFPage and PDFOutline; or support it, as do PDFSelection and PDFDestination.

You initialize a PDFDocument object with PDF data or with a URL to a PDF file. You can then ask for the page count, add or delete pages, perform a find, or parse selected content into an NSString object.

Topics

Initializing Documents

init?(url: URL)

Initializes a PDFDocument object with the contents at the specified URL (if the URL is invalid, this method returns NULL).

init?(data: Data)

Initializes a PDFDocument object with the passed-in data.

init()

Initializes a PDFDocument object.

Reading and Writing PDFs

Read Operations

Operations that let you access documents and pages, manage document security, and work with searching and selections.

Write Operations

Operations that let you write document data to different locations.

Setting the Delegate

var delegate: PDFDocumentDelegate?

The object acting as the delegate for the PDFDocument object.

protocol PDFDocumentDelegate

The delegate for the PDFDocument object.

Constants

enum PDFDocumentPermissions

An enumeration that specifies document permissions status.

struct PDFDocumentAttribute

A structure that specifies document attributes.

struct PDFDocumentWriteOption

A structure that specifies file writing options for a document.

Notifications

Notifications posted by PDFDocument.

static let PDFDocumentDidUnlock: NSNotification.Name

A notification that a document unlocks after a unlock(withPassword:) message.

static let PDFDocumentDidBeginPageFind: NSNotification.Name

A notification that a find operation begins working on a new page of a document.

static let PDFDocumentDidEndPageFind: NSNotification.Name

A notification that a find operation finishes working on a page in a document.

static let PDFDocumentDidFindMatch: NSNotification.Name

A notification that a string match is found in a document.

static let PDFDocumentDidBeginWrite: NSNotification.Name

A notification that a write operation begins working on a document.

static let PDFDocumentDidEndWrite: NSNotification.Name

A notification that a write operation finishes working on a document.

static let PDFDocumentDidBeginPageWrite: NSNotification.Name

A notification that a write operation begins working on a page in a document.

static let PDFDocumentDidEndPageWrite: NSNotification.Name

A notification that a write operation finishes working on a page in a document.

Relationships

Inherits From

See Also

Content Model

class PDFPage

PDFPage, a subclass of NSObject, defines methods used to render PDF pages and work with annotations, text, and selections.

class PDFOutline

A PDFOutline object is an element in a tree-structured hierarchy that can represent the structure of a PDF document.

class PDFSelection

A PDFSelection object identifies a contiguous or noncontiguous selection of text in a PDF document.