<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebPage/exported(as:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:6WebKit0A4PageC8exported2as10Foundation4DataVAC28ExportedContentConfigurationV_tYaKF"
  },
  "title" : "exported(as:)"
}
-->

# exported(as:)

Using the type’s `Transferable` conformance implementation, exports a value as binary data,
optionally with a specified configuration for that type of data.

```
nonisolated final func exported(as representation: WebPage.ExportedContentConfiguration) async throws -> Data
```

## Parameters

`representation`

A configuration for a representation for a specific type of data with optional customizable properties.

## Return Value

The data with the specified representation type.

## Discussion

For example, you can export a 100 pt by 100 pt region of a webpage as a PDF, and allow it to have a transparent background:

```swift
let page = WebPage()
// Load web content and wait for navigation to complete.

let square = CGRect(x: 0, y: 0, width: 100, height: 100)
let pdf = try await page.exported(as: .pdf(region: .rect(square), allowTransparentBackground: true))
```

If no configuration is needed, use the `Transferable` conformance of [`WebPage`](/documentation/WebKit/WebPage) directly:

```swift
let page = WebPage()
// Load web content and wait for navigation to complete.

let pdf = try await page.exported(as: .pdf)
```

> Throws: An error if the specified representation cannot be created from the page.

---

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)