CGPDFDocument

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

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 Managing Encryption. Core Graphics also supports decrypting encrypted documents.

Core Graphics can both display and generate files that are compliant with the PDF standard. When imaging PDF files, CGPDFDocument is the basic type used to represent a PDF document.

Symbols

Creating PDF Document Objects

init?(CGDataProvider)

Creates a Core Graphics PDF document using a data provider.

init?(CFURL)

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

Getting the CFType ID for a PDF Document Object

class var typeID: CFTypeID

Returns the type identifier for Core Graphics PDF documents.

Getting Information About Core Graphics PDF Documents

var catalog: CGPDFDictionaryRef?

Returns the document catalog of a Core Graphics PDF document.

var numberOfPages: Int

Returns the number of pages in a PDF document.

func page(at: Int)

Returns a page from a Core Graphics PDF document.

func getVersion(majorVersion: UnsafeMutablePointer<Int32>, minorVersion: UnsafeMutablePointer<Int32>)

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

var info: CGPDFDictionaryRef?

Gets the information dictionary for a PDF document.

var fileIdentifier: CGPDFArrayRef?

Gets the file identifier for a PDF document.

Managing Encryption

var allowsCopying: Bool

Returns whether the specified PDF document allows copying.

var allowsPrinting: Bool

Returns whether a PDF document allows printing.

var isEncrypted: Bool

Returns whether the specified PDF file is encrypted.

var isUnlocked: Bool

Returns whether the specified PDF document is currently unlocked.

func unlockWithPassword(UnsafePointer<Int8>)

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

Data Types

CGPDFDocument

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