<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGPDFDocument",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@T@CGPDFDocumentRef"
  },
  "title" : "CGPDFDocument"
}
-->

# CGPDFDocument

A document that contains PDF (Portable Document Format) drawing information.

```
class CGPDFDocument
```

## Overview

PDF provides an efficient format for cross-platform exchange of documents with rich content. PDF files can contain multiple pages of images and text. A PDF document object contains all the information relating to a PDF document, including its catalog and contents.

Note that PDF documents may be encrypted, and that some operations may be restricted until a valid password is supplied—see the functions listed in [`Working with an Encrypted PDF Document`](/documentation/CoreGraphics/CGPDFDocument#Working-with-an-Encrypted-PDF-Document).  Core Graphics also supports decrypting encrypted documents.

Core Graphics can both display and generate files that are compliant with the PDF standard.

## Topics

### Creating PDF Documents

[`init(_:)`](/documentation/CoreGraphics/CGPDFDocument/init(_:)-gbq6)

Creates a Core Graphics PDF document using a data provider.

[`init(_:)`](/documentation/CoreGraphics/CGPDFDocument/init(_:)-2gtsd)

Creates a Core Graphics PDF document using data specified by a URL.

### Retaining and Releasing PDF Documents

[`CGPDFDocumentRelease`](/documentation/CoreGraphics/CGPDFDocumentRelease)

Decrements the retain count of a PDF document.

[`CGPDFDocumentRetain`](/documentation/CoreGraphics/CGPDFDocumentRetain)

Increments the retain count of a Core Graphics PDF document.

### Examining a PDF Document

[`catalog`](/documentation/CoreGraphics/CGPDFDocument/catalog)

Returns the document catalog of a Core Graphics PDF document.

[`fileIdentifier`](/documentation/CoreGraphics/CGPDFDocument/fileIdentifier)

Gets the file identifier for a PDF document.

[`info`](/documentation/CoreGraphics/CGPDFDocument/info)

Gets the information dictionary for a PDF document.

[`numberOfPages`](/documentation/CoreGraphics/CGPDFDocument/numberOfPages)

Returns the number of pages in a PDF document.

[`getVersion(majorVersion:minorVersion:)`](/documentation/CoreGraphics/CGPDFDocument/getVersion(majorVersion:minorVersion:))

Returns the major and minor version numbers of a Core Graphics PDF document.

[`page(at:)`](/documentation/CoreGraphics/CGPDFDocument/page(at:))

Returns a page from a Core Graphics PDF document.

### Working with an Encrypted PDF Document

[`isEncrypted`](/documentation/CoreGraphics/CGPDFDocument/isEncrypted)

Returns whether the specified PDF file is encrypted.

[`allowsCopying`](/documentation/CoreGraphics/CGPDFDocument/allowsCopying)

Returns whether the specified PDF document allows copying.

[`allowsPrinting`](/documentation/CoreGraphics/CGPDFDocument/allowsPrinting)

Returns whether a PDF document allows printing.

[`isUnlocked`](/documentation/CoreGraphics/CGPDFDocument/isUnlocked)

Returns whether the specified PDF document is currently unlocked.

[`unlockWithPassword(_:)`](/documentation/CoreGraphics/CGPDFDocument/unlockWithPassword(_:))

Unlocks an encrypted PDF document when a valid password is supplied.

### Getting Page Information

[`CGPDFDocumentGetArtBox`](/documentation/CoreGraphics/CGPDFDocumentGetArtBox)

Returns the art box of a page in a PDF document.

[`CGPDFDocumentGetBleedBox`](/documentation/CoreGraphics/CGPDFDocumentGetBleedBox)

Returns the bleed box of a page in a PDF document.

[`CGPDFDocumentGetCropBox`](/documentation/CoreGraphics/CGPDFDocumentGetCropBox)

Returns the crop box of a page in a PDF document.

[`CGPDFDocumentGetMediaBox`](/documentation/CoreGraphics/CGPDFDocumentGetMediaBox)

Returns the media box of a page in a PDF document.

[`CGPDFDocumentGetRotationAngle`](/documentation/CoreGraphics/CGPDFDocumentGetRotationAngle)

Returns the rotation angle of a page in a PDF document.

[`CGPDFDocumentGetTrimBox`](/documentation/CoreGraphics/CGPDFDocumentGetTrimBox)

Returns the trim box of a page in a PDF document.

### Working with Core Foundation Types

[`typeID`](/documentation/CoreGraphics/CGPDFDocument/typeID)

Returns the type identifier for Core Graphics PDF documents.

### Abstract Types for PDF Document Content

Use these abstract types and related functions to work with the content of a [`CGPDFDocument`](/documentation/CoreGraphics/CGPDFDocument)

A document that contains PDF (Portable Document Format) drawing information. object.

[`CGPDFPage`](/documentation/CoreGraphics/CGPDFPage)

A type that represents a page in a PDF document.

[CGPDFArray](/documentation/CoreGraphics/cgpdfarray)

An array structure within a PDF document.

[CGPDFObject](/documentation/CoreGraphics/cgpdfobject)

An object representing content within a PDF document.

[CGPDFStream](/documentation/CoreGraphics/cgpdfstream)

A stream or sequence of data bytes in a PDF document.

[CGPDFString](/documentation/CoreGraphics/cgpdfstring)

A text string in a PDF document.

[CGPDFScanner](/documentation/CoreGraphics/cgpdfscanner)

A parser object for handling content and operators in a PDF content stream.

[CGPDFDictionary](/documentation/CoreGraphics/cgpdfdictionary)

A dictionary structure within a PDF document.

[CGPDFContentStream](/documentation/CoreGraphics/cgpdfcontentstream)

A representation of one or more content data streams in a PDF page.

[CGPDFOperatorTable](/documentation/CoreGraphics/cgpdfoperatortable)

A set of callback functions for operators used when scanning content in a PDF document.

### Instance Properties

[`accessPermissions`](/documentation/CoreGraphics/CGPDFDocument/accessPermissions)

[`outline`](/documentation/CoreGraphics/CGPDFDocument/outline)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)