---
title: PDFDocument
framework: pdfkit
role: symbol
role_heading: Class
path: pdfkit/pdfdocument
---

# PDFDocument

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

## Declaration

```swift
class PDFDocument
```

## Mentioned in

Adding Custom Graphics to a PDF

## Overview

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:)](pdfkit/pdfdocument/init(url:)-98jte.md)
- [init(data:)](pdfkit/pdfdocument/init(data:).md)
- [init()](pdfkit/pdfdocument/init().md)

### Reading and Writing PDFs

- [Read Operations](pdfkit/read-operations.md)
- [Write Operations](pdfkit/write-operations.md)

### Setting the Delegate

- [delegate](pdfkit/pdfdocument/delegate.md)
- [PDFDocumentDelegate](pdfkit/pdfdocumentdelegate.md)

### Constants

- [PDFDocumentPermissions](pdfkit/pdfdocumentpermissions.md)
- [PDFDocumentAttribute](pdfkit/pdfdocumentattribute.md)
- [PDFDocumentWriteOption](pdfkit/pdfdocumentwriteoption.md)

### Instance Properties

- [accessPermissions](pdfkit/pdfdocument/accesspermissions.md)

### Initializers

- [init(URL:)](pdfkit/pdfdocument/init(url:)-7sttu.md)

### Instance Methods

- [selection(from:at:to:at:with:)](pdfkit/pdfdocument/selection(from:at:to:at:with:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Content Model

- [PDFPage](pdfkit/pdfpage.md)
- [PDFOutline](pdfkit/pdfoutline.md)
- [PDFSelection](pdfkit/pdfselection.md)
