<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFDocument/write(to:withOptions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFDocument(im)writeToURL:withOptions:"
  },
  "title" : "write(to:withOptions:)"
}
-->

# write(to:withOptions:)

Writes the document to the specified URL with the specified options.

```
func write(to url: URL, withOptions options: [PDFDocumentWriteOption : Any]? = nil) -> Bool
```

## See Also

[`dataRepresentation()`](/documentation/PDFKit/PDFDocument/dataRepresentation())

Returns a representation of the document as an `NSData` object.



---

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)