---
title: "init(data:)"
framework: pdfkit
role: symbol
role_heading: Initializer
path: "pdfkit/pdfdocument/init(data:)"
---

# init(data:)

Initializes a PDFDocument object with the passed-in data.

## Declaration

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

## Return Value

Return Value A PDFDocument instance initialized with the passed-in PDF data, or NULL if the object could not be initialized.

## Discussion

Discussion The data must be PDF data encapsulated in an NSData object; otherwise this method returns NULL.

## See Also

### Initializing Documents

- [init(url:)](pdfkit/pdfdocument/init(url:)-98jte.md)
- [init()](pdfkit/pdfdocument/init().md)
