> 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/guides/getting-started/showing-a-pdf.md).

# Quick start - view a document on iOS

Learn how to display a PDF using Apryse SDK. Import PDFNet and Tools, create a document viewer, set the document, and present it on screen. Get started now! The Apryse iOS SDK streamlines secure docum

This guide demonstrates how to display a PDF. To begin working with Apryse SDK, you must have first [added it to your project](/ios/get-started/get-started.md).

1. Apryse must be initialized before using any Apryse classes. This only needs to be done once. This is done as shown:

{% hint style="info" %}
**No trial license key required.**

The trial of Apryse Mobile SDK does not require a trial key. A commercial license key is required for use in a production environment. Please [contact sales](https://apryse.com/form/contact-sales) to purchase a commercial key or if you need any other license key assistance.
{% endhint %}

{% hint style="warning" %}
**Keep your license keys confidential.**

License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).
{% endhint %}

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

```swift
PTPDFNet.initialize("<key-goes-here>")
```

{% endcode %}
{% endtab %}

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

```objc
[PTPDFNet Initialize:@"<key-goes-here>"];
```

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

1. At the top of your source file, import PDFNet and Tools.

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

```swift
import PDFNet
import Tools
```

{% endcode %}
{% endtab %}

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

```objc
#import <PDFNet/PDFNet.h>
#import <Tools/Tools.h>
```

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

1. The following shows how to create a document viewer, set the document to display, and present it on screen.

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

```swift
// Create a PTDocumentController
let documentController = PTDocumentController()

// The PTDocumentController must be in a navigation controller before a document can be opened
let navigationController = UINavigationController(rootViewController: documentController)

// Open an existing local file URL.
let fileURL: URL! = Bundle.main.url(forResource: "sample", withExtension: "pdf")

documentController.openDocument(with: fileURL)

// Show navigation (and document) controller.
self.present(navigationController, animated: true, completion: nil)
```

{% endcode %}
{% endtab %}

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

```objc
// Create a PTDocumentController
PTDocumentController *documentController = [[PTDocumentController alloc] init];

// The PTDocumentController must be in a navigation controller before a document can be opened
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:documentController];

// Open an existing local file URL.
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"Sample" withExtension:@"pdf"];

[documentController openDocumentWithURL:fileURL];

// Show navigation (and document) controller.
[self presentViewController:navigationController animated:YES completion:nil];
```

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


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/ios/guides/getting-started/showing-a-pdf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
