> 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/uwp/ms-office/open-office.md).

# Open MS Office documents and convert to PDF in UWP

Learn how to display a non-PDF file in PDFViewCtrl using the pdftron.UWP API. Follow this tutorial for seamless conversion to PDF and support for various file types. The Apryse uwp SDK streamlines sec

{% hint style="info" %}
Saving annotations back to non-PDF formats is not supported. You can instead save the annotated PDFDoc to a PDF file.
{% endhint %}

`PDFViewCtrl` has a powerful and seamless conversion system which allows you to stream documents during conversion to PDF. It supports the following file types:

* Office file conversion: .docx, .pptx, .xlsx, .doc. (with the office conversion Add-On module)
* Image conversion: .bmp, .jpg, .tif, .png, .gif
* Image collections (zip archives with any type of image listed above)
* Markdown: .md (with the office conversion Add-On module)

In this tutorial you will be able to display a non-PDF file in `PDFViewCtrl`.

Before going forward, please make sure you have finished setting up `PDFViewCtrl` as described in [Implement PDF Viewer Control in UWP app](/uwp/viewer/using-pdfviewctrl.md).

The easiest way to display a non-PDF file in `PDFViewCtrl` is through the `pdftron.UWP` API.

## Directly from an IRandomAccessStream

You must first retrieve a file as a [IRAndomAccessStream](https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.irandomaccessstream?view=winrt-20348) Interface:

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

```csharp
Windows.Storage.Streams.IRandomAccessStream StreamForConversion;
```

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

Then load the IRandomAccessStream Interface into an [IFilter](https://sdk.apryse.com/api/uwp/guides/html/0fbdf234-9acd-0e47-0184-39e92c38e129.htm) Interface:

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

```csharp
pdftron.Filters.IFilter filter = new pdftron.Filters.RandomAccessStreamFilter(StreamForConversion);
```

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

Then add the following when you would like to show the document in your `PDFViewCtrl`:

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

```csharp
pdftron.PDF.DocumentConversion.conversion = pdftron.PDF.Convert.UniversalConversion(filter, null);
pdftron.PDF.PDFViewCtrl.PDFViewCtrl.OpenUniversalDocument(conversion);
```

{% 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/uwp/ms-office/open-office.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.
