<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: -",
    "macOS: 12.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebView/pdf(configuration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:So9WKWebViewC6WebKitE3pdf13configuration10Foundation4DataVSo18WKPDFConfigurationC_tYaKF"
  },
  "title" : "pdf(configuration:)"
}
-->

# pdf(configuration:)

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

```
@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

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

## 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)