<!--
{
  "documentType" : "article",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/cgpdfarray",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "CGPDFArray"
}
-->

# CGPDFArray

An array structure within a PDF document.

## Discussion

PDF arrays may be heterogeneous—that is, they may contain any other PDF objects, including PDF strings, PDF dictionaries, and other PDF arrays.

Many `CGPDFArray` functions to retrieve values from a PDF array take the form:

```objc
bool CGPDFArrayGet<DataType> (
 CGPDFArrayRef array,
 size_t index,
 <DataType>Ref *value
);
```

These functions test the data type of the object at the specified index. If the object is not of the expected type, the function returns <doc://com.apple.documentation/documentation/Swift/false>. If the object is of the expected type, the function returns <doc://com.apple.documentation/documentation/Swift/true>, and the object is passed back in the `value` parameter.

This type is not derived from <doc://com.apple.documentation/documentation/CoreFoundation/CFTypeRef> and therefore there are no functions for retaining and releasing it. [`CGPDFArrayRef`](/documentation/CoreGraphics/CGPDFArrayRef) objects exist only as constituent parts of a [`CGPDFDocument`](/documentation/CoreGraphics/CGPDFDocument) object, and they are managed by their container.

## Topics

### Getting Data from a PDF Array

[`CGPDFArrayGetArray`](/documentation/CoreGraphics/CGPDFArrayGetArray(_:_:_:))

Returns whether an object at a given index in a PDF array is another PDF array and, if so, retrieves that array.

[`CGPDFArrayGetBoolean`](/documentation/CoreGraphics/CGPDFArrayGetBoolean(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF Boolean and, if so, retrieves that Boolean.

[`CGPDFArrayGetCount`](/documentation/CoreGraphics/CGPDFArrayGetCount(_:))

Returns the number of items in a PDF array.

[`CGPDFArrayGetDictionary`](/documentation/CoreGraphics/CGPDFArrayGetDictionary(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF dictionary and, if so, retrieves that dictionary.

[`CGPDFArrayGetInteger`](/documentation/CoreGraphics/CGPDFArrayGetInteger(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF integer and, if so, retrieves that object.

[`CGPDFArrayGetName`](/documentation/CoreGraphics/CGPDFArrayGetName(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF name reference (represented as a constant C string) and, if so, retrieves that name.

[`CGPDFArrayGetNull`](/documentation/CoreGraphics/CGPDFArrayGetNull(_:_:))

Returns whether an object at a given index in a Quartz PDF array is a PDF null.

[`CGPDFArrayGetNumber`](/documentation/CoreGraphics/CGPDFArrayGetNumber(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF number and, if so, retrieves that object.

[`CGPDFArrayGetObject`](/documentation/CoreGraphics/CGPDFArrayGetObject(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF object and, if so, retrieves that object.

[`CGPDFArrayGetStream`](/documentation/CoreGraphics/CGPDFArrayGetStream(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF stream and, if so, retrieves that stream.

[`CGPDFArrayGetString`](/documentation/CoreGraphics/CGPDFArrayGetString(_:_:_:))

Returns whether an object at a given index in a PDF array is a PDF string and, if so, retrieves that string.

### Data Types

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

An opaque type that encapsulates a PDF array.

## See Also

  [Quartz 2D Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066)



---

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)