---
title: "pdf(configuration:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebview/pdf(configuration:)"
---

# pdf(configuration:)

Generates PDF data from the web view’s contents asynchronously.

## Declaration

```swift
@MainActor @preconcurrency func pdf(configuration: WKPDFConfiguration = .init()) async throws -> Data
```

## Parameters

- `configuration`: The object that specifies the portion of the web view to capture as PDF data.

## Return Value

Return Value A data object that contains the PDF data to use for rendering the contents of the web view.

## See Also

### Capturing the web view’s content

- [takeSnapshot(with:completionHandler:)](webkit/wkwebview/takesnapshot(with:completionhandler:).md)
- [createPDF(configuration:completionHandler:)](webkit/wkwebview/createpdf(configuration:completionhandler:).md)
- [createWebArchiveData(completionHandler:)](webkit/wkwebview/createwebarchivedata(completionhandler:).md)
- [printOperation(with:)](webkit/wkwebview/printoperation(with:).md)
- [WKSnapshotConfiguration](webkit/wksnapshotconfiguration.md)
- [WKPDFConfiguration](webkit/wkpdfconfiguration.md)
