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

# Quick start - view a document in Xamarin

Learn how to display a PDF in Xamarin.iOS with this step-by-step tutorial. Add a PDF to your project and initialize Apryse SDK for seamless integration. Create a document viewer effortlessly. The Apry

{% hint style="info" %}
**This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here .**
{% endhint %}

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

1. Add a PDF to your project:

* Right click on `Resources`
* Click on `Add` > `Add Files`
* Choose a file (in this tutorial, let's say we added a `sample.pdf`) and confirm add
* Make sure the `Build Action` of the file is set to `BundleResource`

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="C#" %}
{% code lineNumbers="true" %}

```csharp
PDFNet.Initialize("<key-goes-here>");
```

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

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

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
using pdftron;
using pdftron.PDF.Controls;
```

{% 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="C#" %}
{% code lineNumbers="true" %}

```csharp
// Create a PTDocumentController
var documentController = new PTDocumentController();

// The PTDocumentController must be in a navigation controller before a document can be opened
var navigationController = new UINavigationController(documentController);

// Open an existing local file URL.
var fileURL = NSBundle.MainBundle.GetUrlForResource("sample", "pdf");

bool success = documentController.OpenDocumentWithURL(fileURL);

// Show navigation (and document) controller.
this.PresentViewController(navigationController, true, null);
```

{% 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 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/xamarin/guides/getting-started/showing-a-pdf.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.
