CGPDFArray Reference

Derived from
None
Framework
ApplicationServices/ApplicationServices.h
Companion guide
Declared in
CGPDFArray.h

Overview

The CGPDFArray header file defines an opaque type that encapsulates a PDF array. A PDF array represents an array structure in a PDF document. 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:

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 false. If the object is of the expected type, the function returns true, and the object is passed back in the value parameter.

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

Functions

CGPDFArrayGetArray

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

bool CGPDFArrayGetArray (
   CGPDFArrayRef array,
   size_t index,
   CGPDFArrayRef *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

On input, a pointer to a PDF array. If the value at the specified index is a PDF array, then on return that array, otherwise the value is unspecified.

Return Value

Returns true if there is a PDF array at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetBoolean

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

bool CGPDFArrayGetBoolean (
   CGPDFArrayRef array,
   size_t index,
   CGPDFBoolean *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of array (0 to N-1, where N is the count of array), the behavior is undefined.

value

On input, a pointer to a PDF Boolean. If the value at the specified index is a PDF Boolean, then on return that Boolean, otherwise the value is undefined.

Return Value

Returns true if there is a PDF Boolean at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetCount

Returns the number of items in a PDF array.

size_t CGPDFArrayGetCount (
   CGPDFArrayRef array
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

Return Value

Returns the number of items in the array.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetDictionary

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

bool CGPDFArrayGetDictionary (
   CGPDFArrayRef array,
   size_t index,
   CGPDFDictionaryRef *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

On input, a pointer to a PDF dictionary. If the value at the specified index is a PDF dictionary, then on return that dictionary, otherwise the value is undefined.

Return Value

Returns true if there is a PDF dictionary at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetInteger

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

bool CGPDFArrayGetInteger (
   CGPDFArrayRef array,
   size_t index,
   CGPDFInteger *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

On input, a pointer to a PDF integer. If the value at the specified index is a PDF integer value, then on return contains that value, otherwise the value is undefined.

Return Value

Returns true if there is a PDF integer at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

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.

bool CGPDFArrayGetName (
   CGPDFArrayRef array,
   size_t index,
   const char **value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

An uninitialized pointer to a constant C string. If the value at the specified index is a reference to a PDF name (represented by a constant C string) then upon return, contains that value; otherwise the value is undefined.

Return Value

Returns true if there is an array of characters at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetNull

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

bool CGPDFArrayGetNull (
   CGPDFArrayRef array,
   size_t index
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

Return Value

Returns true if there is a PDF null at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetNumber

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

bool CGPDFArrayGetNumber (
   CGPDFArrayRef array,
   size_t index,
   CGPDFReal *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

On input, a pointer to a PDF number. If the value at the specified index is a PDF number, then on return contains that value, otherwise the value is undefined.

Return Value

Returns true if there is a PDF number at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetObject

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

bool CGPDFArrayGetObject (
   CGPDFArrayRef array,
   size_t index,
   CGPDFObjectRef *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

On input, a pointer to a PDF object. If the value at the specified index is a PDF object, then on return contains that object, otherwise the value is undefined.

Return Value

Returns true if there is a PDF object at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetStream

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

bool CGPDFArrayGetStream (
   CGPDFArrayRef array,
   size_t index,
   CGPDFStreamRef *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

On input, a pointer to a PDF stream. If the value at the specified index is a PDF stream, then on return that stream, otherwise the value is undefined.

Return Value

Returns true if there is a PDF stream at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

CGPDFArrayGetString

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

bool CGPDFArrayGetString (
   CGPDFArrayRef array,
   size_t index,
   CGPDFStringRef *value
);
Parameters
array

A PDF array. If this parameter is not a valid PDF array, the behavior is undefined.

index

The index of the value to retrieve. If the index is outside the index space of the array (0 to N-1, where N is the count of the array), the behavior is undefined.

value

On input, a pointer to a PDF string. If the value at the specified index is a PDF string, then on return that string, otherwise the value is undefined.

Return Value

Returns true if there is a PDF stream at the specified index, otherwise false.

Availability
  • Available in OS X version 10.3 and later.
Declared In
CGPDFArray.h

Data Types

CGPDFArrayRef

An opaque type that encapsulates a PDF array.

typedef struct CGPDFArray *CGPDFArrayRef;
Availability
  • Available in OS X v10.3 and later.
Declared In
CGPDFArray.h