<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebView/takeSnapshot(with:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKWebView(im)takeSnapshotWithConfiguration:completionHandler:"
  },
  "title" : "takeSnapshot(with:completionHandler:)"
}
-->

# takeSnapshot(with:completionHandler:)

Generates a platform-native image from the web view’s contents asynchronously.

```
func takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?, completionHandler: @escaping @MainActor @Sendable (NSImage?, (any Error)?) -> Void)
```

## Parameters

`snapshotConfiguration`

The object that specifies the portion of the web view to capture, and other capture-related behaviors.

`completionHandler`

The completion handler to call when the image is ready. This block has no return value and takes the following parameters:

- snapshotImage: A platform-native image that contains the specified portion of the web view.
- error: An error object if a problem occurred, or `nil` on success.

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