<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGraphicsSetPDFContextURLForRect(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@F@UIGraphicsSetPDFContextURLForRect"
  },
  "title" : "UIGraphicsSetPDFContextURLForRect(_:_:)"
}
-->

# UIGraphicsSetPDFContextURLForRect(_:_:)

Links a rectangular area on the current page to the specified URL.

```
func UIGraphicsSetPDFContextURLForRect(_ url: URL, _ rect: CGRect)
```

## Parameters

`url`

The URL to open.

`rect`

A rectangle on the current page of the PDF context.

## Discussion

You use this function to create external links within a PDF document. If the URL you specify is a type handled by a different application, tapping the rectangle opens that application.

If the current graphics context is not a PDF context, this function does nothing.

---

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)