<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPDFImageRep/init(data:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPDFImageRep(im)initWithData:"
  },
  "title" : "init(data:)"
}
-->

# init(data:)

Returns a representation of an image initialized with the specified PDF data.

```
init?(data pdfData: Data)
```

## Parameters

`pdfData`

A data object containing the PDF data for the image.

## Return Value

An initialized [`NSPDFImageRep`](/documentation/AppKit/NSPDFImageRep) object, or `nil` if the object could not be initialized. Initialization may fail if the PDF data does not conform to the PDF file format.

## See Also

[`pdfRepresentation`](/documentation/AppKit/NSPDFImageRep/pdfRepresentation)

The PDF representation of the representation’s image.

[`imageRepWithData:`](/documentation/AppKit/NSPDFImageRep/imageRepWithData:)

Creates and returns a representation of an image initialized with the specified PDF data.



---

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)