Function

CGPDFObjectGetValue

Returns whether an object is of a given type and if it is, retrieves its value.

Declaration

bool CGPDFObjectGetValue(CGPDFObjectRef object, CGPDFObjectType type, void *value);

Parameters

object

A PDF object.

type

A PDF object type.

value

If the object parameter is a PDF object of the specified type, then on return contains that object, otherwise the value is unspecified.

Return Value

Returns YES if the specified object is a PDF object of the specified type, otherwise NO.

Discussion

The function gets the value of the object parameter. If the type of object is equal to the type specified, then:

  • If the value parameter is not a null pointer, then the value of object is copied to value, and the function returns YES.

  • If the value parameter is a null pointer, then the function simply returns YES. This allows you to test whether object is of the type specified.

If the type of object is kCGPDFObjectTypeInteger and type is equal to kCGPDFObjectTypeReal, then the value of object is converted to floating point, the result copied to value, and the function returns YES. If none of the preceding conditions is met, returns NO.

See Also

Getting Object Types and Values

CGPDFObjectGetType

Returns the PDF type identifier of an object.