---
title: "addDocumentMetadata(_:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/adddocumentmetadata(_:)"
---

# addDocumentMetadata(_:)

Associates custom metadata with the PDF document.

## Declaration

```swift
func addDocumentMetadata(_ metadata: CFData?)
```

## Parameters

- `metadata`: A stream of XML data that is formatted according to the Extensible Metadata Platform, as described in section 10.2.2., “Metadata Streams”, of the PDF 1.7 specification.

## See Also

### Managing a PDF Graphics Context

- [beginPDFPage(_:)](coregraphics/cgcontext/beginpdfpage(_:).md)
- [endPDFPage()](coregraphics/cgcontext/endpdfpage().md)
- [addDestination(_:at:)](coregraphics/cgcontext/adddestination(_:at:).md)
- [setDestination(_:for:)](coregraphics/cgcontext/setdestination(_:for:).md)
- [setURL(_:for:)](coregraphics/cgcontext/seturl(_:for:).md)
- [closePDF()](coregraphics/cgcontext/closepdf().md)
