# Add link annotations to PDFs on iOS

Nutrient supports all common types of link annotations, including page, web, and email links. Tapping on a link will automatically invoke both the saved action (see the [PDF actions](https://www.nutrient.io/../../annotations/pdf-actions) guide) and the correct task, such as changing the page or displaying another document/opening a URL.

By default, Nutrient will parse annotations, including links, from the document.

## Creation

### User interface

It’s possible to create a link annotation in the UI either by selecting text and tapping the link annotation symbol in the contextual menu, or by using the link tool on the annotation toolbar and selecting text or an arbitrary rectangular area on the page. This will show a UI where you can choose between linking to a page in the current document or linking to a website.

Link creation and editing in the UI is enabled by default. This can be disabled by removing [`Annotation.Tool.link`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/tool/link) from [`editableAnnotationTypes`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfconfiguration/editableannotationtypes).

### Programmatically

You can also manually create link annotations and add them to a document (see the [programmatically creating annotations](https://www.nutrient.io/../../annotations/programmatically-creating-annotations) guide). For adding link annotations, you should create objects of the [`LinkAnnotation`](https://www.nutrient.io/api/ios/documentation/pspdfkit/linkannotation) type.

[`LinkAnnotation`](https://www.nutrient.io/api/ios/documentation/pspdfkit/linkannotation) can be initialized with an [`Action`](https://www.nutrient.io/api/ios/documentation/pspdfkit/action) subclass. The most used subclasses are [`URLAction`](https://www.nutrient.io/api/ios/documentation/pspdfkit/urlaction) for web links and [`GoToAction`](https://www.nutrient.io/api/ios/documentation/pspdfkit/gotoaction) for page links.

## Style

By default, links are invisible, without a border and a background. But if a link annotation has [`borderColor`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/bordercolor) or [`lineWidth`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/linewidth) set, this will be honored.

Additionally, you can change the background color of link annotation views via `UIAppearance`. The set background color will always be shown for all link annotations. It should be used to highlight them, so it is recommended that this color has a high transparency. Setting the background color can be achieved with this logic:

### SWIFT

```swift

// Customize the link annotation's appearance.
LinkAnnotationView.appearance().backgroundColor = UIColor.blue.withAlphaComponent(0.1)

```

### OBJECTIVE-C

```objc

// Customize the link annotation's appearance.
[[PSPDFLinkAnnotationView appearance] setBackgroundColor:[UIColor.blueColor colorWithAlphaComponent:0.1]];

```

## Autodetecting links

Nutrient is capable of analyzing the page contents and automatically adding links to URLs and phone numbers. This is slightly expensive since text needs to be parsed and analyzed, but it’s done in a background process, so in most cases, it’s not noticeably slower. Set [`autodetectTextLinkTypes`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document/autodetecttextlinktypes) to [`TextCheckingType.all`](https://www.nutrient.io/api/ios/documentation/pspdfkit/textcheckingtype/all) to enable detection for all supported types.

Note that autodetecting a link only works if there is no overlapping link annotation at the same location the autodetected link would be located at on a PDF page. This is done to avoid creating duplicate link annotations over text that already has a link annotation saved in the PDF.
---

## Related pages

- [Explore flexible PDF annotation actions on iOS](/guides/ios/annotations/pdf-actions.md)

