> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/ios/bookmarks/user-bookmarks-i.md).

# User-defined bookmarks for iOS

Discover how to use the PTBookmarkViewController class to manage user-defined bookmarks in your PDF documents. Learn how to navigate through your document efficiently with this Apryse-specific feature

The [`PTBookmarkViewController`](https://sdk.apryse.com/api/ios/Classes/PTBookmarkViewController.html) class shows a list of user-defined bookmarks that can be used to navigate through the document. The user-defined bookmarks are Apryse specific features that may not be shown in other PDF viewer apps. If you want to manage PDF bookmarks so that they can be processed in other standard PDF viewers, see the [outline view controller guide](/ios/bookmarks/outline.md).

![](https://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%2Fuploads%2Fgit-blob-0c6671767140fba510adb152c66b82b412cd37b6%2F57576f04ec374441f9486f31f92fdcb519bf9119-1242x2208.png?alt=media)

*The user bookmarks control is part of the Tools library, so make sure you have* [*added the Tools library to your project*](/ios/ui-customization/setup.md)*.*

## Show a bookmark view controller

To create a new bookmark view controller instance and display it from another view controller, supply a `PTPDFViewCtrl` instance to the `PTBookmarkViewController` designated initializer:

{% tabs %}
{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
// Initialize bookmark view controller with a PTPDFViewCtrl instance.
let bookmarkViewController = PTBookmarkViewController(pdfViewCtrl: pdfViewCtrl)

// Set the current view controller as the bookmark view controller's delegate.
bookmarkViewController.delegate = self

let navigationController = UINavigationController(rootViewController: bookmarkViewController)
if ( UIDevice.current.userInterfaceIdiom == .pad ) {
    navigationController.modalPresentationStyle = .popover
    navigationController.popoverPresentationController?.barButtonItem = bookmarksButton
}

self.present(navigationController, animated: true, completion: nil)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
// Initialize bookmark view controller with a PTPDFViewCtrl instance.
PTBookmarkViewController *bookmarkViewController = [[PTBookmarkViewController alloc] initWithPDFViewCtrl:pdfViewCtrl];

// Set the current view controller as the bookmark view controller's delegate.
bookmarkViewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:bookmarkViewController];
if ( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad ) {
    navigationController.modalPresentationStyle = UIModalPresentationPopover;
    navigationController.popoverPresentationController.barButtonItem = self.bookmarksButton;
}

[self presentViewController:navigationController animated:YES completion:nil];
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**The bookmark view controller must be pushed onto a navigation controller's stack before being shown.**
{% endhint %}

{% hint style="info" %}
**Presenting on iPads:**

The bookmark view controller is designed to be presented in a popover on iPads. To do so, you must provide the `PTBookmarkViewController`'s [`UIPopoverPresentationController`](https://developer.apple.com/uikit/uipopoverpresentationcontroller/) with either:

* a [`sourceRect`](https://developer.apple.com/uikit/uipopoverpresentationcontroller/1622324-sourcerect/) AND
* a [`sourceView`](https://developer.apple.com/uikit/uipopoverpresentationcontroller/1622313-sourceview/)

OR

* a [`barButtonItem`](https://developer.apple.com/uikit/uipopoverpresentationcontroller/1622314-barbuttonitem/)

as in the example above.
{% endhint %}

You can set a delegate to be notified by the bookmark view controller when bookmarks are selected with the `PTBookmarkViewControllerDelegate` protocol. (See the CompleteReader example for usage of a `PTBookmarkViewController`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/ios/bookmarks/user-bookmarks-i.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
