---
title: "iOS PDF viewer with annotations | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/ios/getting-started/rendering-annotations/"
md_url: "https://www.nutrient.io/guides/ios/getting-started/rendering-annotations.md"
last_updated: "2026-05-15T19:10:05.040Z"
description: "Nutrient offers several options for rendering a single annotation object. This article serves as a step-by-step guide to get you started quickly."
---

# Rendering annotations in our iOS PDF viewer

Nutrient offers several options for rendering a single [`annotation`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation) object. This article serves as a step-by-step guide to get you started quickly.

Before loading a document and rendering its annotations, you have to initialize Nutrient by providing your license. Make sure to follow the steps in our [adding the license key](/guides/ios/getting-started/adding-the-license-key.md) guide before continuing with this guide, in order to have Nutrient fully initialized.

## Loading a document

The first step in rendering annotations of a PDF is to load the document in memory. The [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) class offers a variety of methods for doing this. The following example loads a PDF document from the app’s `Samples` directory using [`Document(url:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document/init(url:)):

### SWIFT

```swift

let samplesURL = Bundle.main.resourceURL?.appendingPathComponent("Samples")
let documentURL = samplesURL?.appendingPathComponent("document.pdf")
let document = Document(url: documentURL)

```

### OBJECTIVE-C

```objc

NSURL *samplesURL = [NSBundle.mainBundle.resourceURL URLByAppendingPathComponent:@"Samples"];
NSURL *documentURL = [samplesURL URLByAppendingPathComponent:@"document.pdf"];
PSPDFDocument *document = [[PSPDFDocument alloc] initWithURL:documentURL];

```

The complete list of available document initializers is provided in our [`PSPDFDocument` Initialization API reference](https://www.nutrient.io/api/ios/documentation/pspdfkit/document).

## Retrieving annotations

To retrieve all the annotations of your loaded [`Document`] instance, call [`Document.allAnnotations(of:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document/allannotations(of:)). For example, you can retrieve all ink annotations from a document, like so:

### SWIFT

```swift

// Retrieves all ink annotations of the document.
let annotations = document.allAnnotations(of:.all).values.flatMap { $0 }

```

### OBJECTIVE-C

```objc

// Retrieves all ink annotations of the document.
NSMutableArray<PSPDFAnnotation *> *inkAnnotations = [NSMutableArray<PSPDFAnnotation *> array];
for (NSArray<PSPDFAnnotation *> *annotations in [document allAnnotationsOfType:PSPDFAnnotationTypeInk].allValues) {
	[inkAnnotations addObjectsFromArray:annotations];
}

```

You can also query annotations from a specific page using [`Document.annotationsForPage(at:type:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document/annotationsforpage(at:type:)):

### SWIFT

```swift

// Retrieves all ink annotations of a given page index of the loaded document.
let pageIndex =...
let inkAnnotations = document.annotationsForPage(at: pageIndex, type:.ink)

```

### OBJECTIVE-C

```objc

// Retrieves all ink annotations of a given page index of the loaded document.
NSUInteger pageIndex =...
NSMutableArray<PSPDFAnnotation *> *inkAnnotations = [document annotationsForPageAtIndex:pageIndex type:PSPDFAnnotationTypeInk];

```

If you want to retrieve all of your document’s annotations at once, you can pass `Annotation.Kind.all`.

## Rendering annotations

You can render an annotation as a `UIImage` using [`Annotation.image(size:options:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation/image(size:options:)):

### SWIFT

```swift

// Render annotation as a `UIImage`.
let renderedImage = annotation.image(with: CGSize(width: 200, height: 200), options: nil)

```

### OBJECTIVE-C

```objc

// Render annotation as a `UIImage`.
UIImage *renderedImage = [annotation imageWithSize:CGSizeMake(200.f, 200.f) options:nil];

```

The bounding box is using [PDF coordinates](/guides/ios/faq/coordinate-spaces.md), which, unlike UIKit’s coordinates, are vertically flipped.
---

## Related pages

- [Customize PDF fonts on iOS](/guides/ios/features/custom-fonts.md)
- [Coordinate space conversion](/guides/ios/faq/coordinate-spaces.md)
- [Rendering PDF forms in our iOS viewer](/guides/ios/viewer/rendering/pdf-forms.md)
- [PDF rendering library for iOS](/guides/ios/getting-started/rendering-pdf-pages.md)

