---
title: "createWebArchiveData(completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebview/createwebarchivedata(completionhandler:)"
---

# createWebArchiveData(completionHandler:)

Creates a web archive of the web view’s current contents asynchronously.

## Declaration

```swift
@MainActor @preconcurrency func createWebArchiveData(completionHandler: @escaping @MainActor @Sendable (Result<Data, any Error>) -> Void)
```

## Parameters

- `completionHandler`: The completion handler block to call when the web archive data is ready. This block has no return value and takes the following parameters:

## 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)
- [pdf(configuration:)](webkit/wkwebview/pdf(configuration:).md)
- [printOperation(with:)](webkit/wkwebview/printoperation(with:).md)
- [WKSnapshotConfiguration](webkit/wksnapshotconfiguration.md)
- [WKPDFConfiguration](webkit/wkpdfconfiguration.md)
