<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.3.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGPDFObjectGetValue(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGPDFObjectGetValue"
  },
  "title" : "CGPDFObjectGetValue(_:_:_:)"
}
-->

# CGPDFObjectGetValue(_:_:_:)

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

```
func CGPDFObjectGetValue(_ object: CGPDFObjectRef, _ type: CGPDFObjectType, _ value: UnsafeMutableRawPointer?) -> Bool
```

## 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 <doc://com.apple.documentation/documentation/Swift/true> if the specified object is a PDF object of the specified type, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## 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 <doc://com.apple.documentation/documentation/Swift/true>.
- If the `value` parameter is a null pointer, then the function simply returns <doc://com.apple.documentation/documentation/Swift/true>. This allows you to test whether `object` is of the type specified.

If the type of `object` is [`CGPDFObjectType.integer`](/documentation/CoreGraphics/CGPDFObjectType/integer) and `type` is equal to [`CGPDFObjectType.real`](/documentation/CoreGraphics/CGPDFObjectType/real), then the value of `object` is converted to floating point, the result copied to `value`, and the function returns <doc://com.apple.documentation/documentation/Swift/true>. If none of the preceding conditions is met, returns <doc://com.apple.documentation/documentation/Swift/false>.

---

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)