<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGraphicsPDFRenderer/pdfData(actions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGraphicsPDFRenderer(im)PDFDataWithActions:"
  },
  "title" : "pdfData(actions:)"
}
-->

# pdfData(actions:)

Creates a PDF from a set of drawing instructions and returns it as a data object.

```
func pdfData(actions: (UIGraphicsPDFRendererContext) -> Void) -> Data
```

## Parameters

`actions`

A [`UIGraphicsPDFRenderer.DrawingActions`](/documentation/UIKit/UIGraphicsPDFRenderer/DrawingActions) block that, when invoked by the renderer, executes a set of drawing instructions to create the output PDF.

## Return Value

A <doc://com.apple.documentation/documentation/Foundation/Data> object that contains the encoded PDF.

## Discussion

You provide a set of drawing instructions as the block argument to this method, and the method returns the resulting PDF encoded in a <doc://com.apple.documentation/documentation/Foundation/Data> object.

You can call this method repeatedly to create multiple PDFs, each of which has identical dimensions and format.

---

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)