---
title: "screenshotService(_:generatePDFRepresentationWithCompletion:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiscreenshotservicedelegate/screenshotservice(_:generatepdfrepresentationwithcompletion:)"
---

# screenshotService(_:generatePDFRepresentationWithCompletion:)

Generates a high-fidelity PDF version of the entire content in a given window scene.

## Declaration

```swift
optional func screenshotService(_ screenshotService: UIScreenshotService, generatePDFRepresentationWithCompletion completionHandler: @escaping (Data?, Int, CGRect) -> Void)
```

```swift
optional func screenshotServiceGeneratePDFRepresentation(_ screenshotService: UIScreenshotService) async -> (Data?, Int, CGRect)
```

## Parameters

- `screenshotService`: A screenshot service object assigned to the relevant doc://com.apple.uikit/documentation/UIKit/UIWindowScene object. Use the window scene to retrieve the windows of your interface, and generate the PDF content from those windows.
- `completionHandler`: The completion handler block to call with the resulting PDF data. You must call this handler block at the end of your implementation, and pass in the relevant data. This handler block has no return value and takes the following parameters: Specify doc://com.apple.documentation/documentation/CoreGraphics/CGRectZero if you cannot provide the visible rectangle, or if you want the system to always display the PDF content starting at the top of the page.

## Discussion

Discussion When the user takes a screenshot of your app, UIKit calls this method to ask you for a PDF version of your content. In your implementation, create a high-fidelity PDF version of your content. At the end of your method, call completionHandler with the results.
