CGPDFDictionary

A dictionary structure within a PDF document.

Overview

Dictionary objects are the main building blocks of a PDF document. A key-value pair within a dictionary is called an entry. In a PDF dictionary, the key must be an array of characters. Within a given dictionary, the keys are unique—that is, no two keys in a single dictionary are equal (as determined by strcmp). The value associated with a key can be any kind of PDF object, including another dictionary. Dictionary objects are the main building blocks of a PDF document.

Many functions that retrieve values from a PDF dictionary take the form:

bool CGPDFDictionaryGet<DataType> (
 CGPDFDictionaryRef dictionary,
 const char *key,
 <DataType>Ref *value
);

These functions test whether there is an object associated with the specified key. If there is an object associated with the specified key, they test its data type. If there is no associated object, or if there is but it is not of the expected type, the function returns false. If there is an object associated with the specified key and it is of the expected type, the function returns true and the object is passed back in the value parameter.

This object is not derived from CFType and therefore there are no functions for retaining and releasing it. CGPDFDictionary objects exist only as constituent parts of a CGPDFDocument object, and they are managed by their container.

Topics

Applying a Function to All Entries

Getting Data from a Dictionary

func CGPDFDictionaryGetArray(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFArrayRef?>?) -> Bool

Returns whether there is a PDF array associated with a specified key in a PDF dictionary and, if so, retrieves that array.

func CGPDFDictionaryGetBoolean(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFBoolean>?) -> Bool

Returns whether there is a PDF Boolean value associated with a specified key in a PDF dictionary and, if so, retrieves the Boolean value.

func CGPDFDictionaryGetCount(CGPDFDictionaryRef) -> Int

Returns the number of entries in a PDF dictionary.

func CGPDFDictionaryGetDictionary(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFDictionaryRef?>?) -> Bool

Returns whether there is another PDF dictionary associated with a specified key in a PDF dictionary and, if so, retrieves that dictionary.

func CGPDFDictionaryGetInteger(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFInteger>?) -> Bool

Returns whether there is a PDF integer associated with a specified key in a PDF dictionary and, if so, retrieves that integer.

func CGPDFDictionaryGetName(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<UnsafePointer<Int8>?>?) -> Bool

Returns whether an object with a specified key in a PDF dictionary is a PDF name reference (represented as a constant C string) and, if so, retrieves that name.

func CGPDFDictionaryGetNumber(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFReal>?) -> Bool

Returns whether there is a PDF number associated with a specified key in a PDF dictionary and, if so, retrieves that number.

func CGPDFDictionaryGetObject(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFObjectRef?>?) -> Bool

Returns whether there is a PDF object associated with a specified key in a PDF dictionary and, if so, retrieves that object.

func CGPDFDictionaryGetStream(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFStreamRef?>?) -> Bool

Returns whether there is a PDF stream associated with a specified key in a PDF dictionary and, if so, retrieves that stream.

func CGPDFDictionaryGetString(CGPDFDictionaryRef, UnsafePointer<Int8>, UnsafeMutablePointer<CGPDFStringRef?>?) -> Bool

Returns whether there is a PDF string associated with a specified key in a PDF dictionary and, if so, retrieves that string.

Callbacks

typealias CGPDFDictionaryApplierFunction

Performs custom processing on a key-value pair from a PDF dictionary, using optional contextual information.

Data Types

typealias CGPDFDictionaryRef

A type that encapsulates a PDF dictionary.

See Also

Abstract Types for PDF Document Content

CGPDFPage

A page in a PDF document.

CGPDFArray

An array structure within a PDF document.

CGPDFObject

An object representing content within a PDF document.

CGPDFStream

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

CGPDFString

A text string in a PDF document.

CGPDFScanner

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

CGPDFContentStream

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

CGPDFOperatorTable

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