---
title: "CGPDFStreamCopyData(_:_:)"
framework: coregraphics
role: symbol
role_heading: Function
path: "coregraphics/cgpdfstreamcopydata(_:_:)"
---

# CGPDFStreamCopyData(_:_:)

Returns the data associated with a PDF stream.

## Declaration

```swift
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—doc://com.apple.coregraphics/documentation/CoreGraphics/CGPDFDataFormat/raw, doc://com.apple.coregraphics/documentation/CoreGraphics/CGPDFDataFormat/jpegEncoded, or doc://com.apple.coregraphics/documentation/CoreGraphics/CGPDFDataFormat/JPEG2000.

## Return Value

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

## See Also

### Getting Data from a PDF Stream

- [CGPDFStreamGetDictionary(_:)](coregraphics/cgpdfstreamgetdictionary(_:).md)
