<!--
{
  "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/CGPDFStreamCopyData(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGPDFStreamCopyData"
  },
  "title" : "CGPDFStreamCopyData(_:_:)"
}
-->

# CGPDFStreamCopyData(_:_:)

Returns the data associated with a PDF stream.

```
func CGPDFStreamCopyData(_ stream: CGPDFStreamRef, _ format: UnsafeMutablePointer<CGPDFDataFormat>) -> CFData?
```

## Parameters

`stream`

A PDF stream.

`format`

On return, contains a constant that specifies the format of the data returned—[`CGPDFDataFormat.raw`](/documentation/CoreGraphics/CGPDFDataFormat/raw), [`CGPDFDataFormat.jpegEncoded`](/documentation/CoreGraphics/CGPDFDataFormat/jpegEncoded), or [`CGPDFDataFormat.JPEG2000`](/documentation/CoreGraphics/CGPDFDataFormat/JPEG2000).

## Return Value

A CFData object that contains a copy of the stream data. You are responsible for releasing this object.

## Discussion

---

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)