> 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/viewer/reflow.md).

# Reflow document content in UWP

Learn how to make PDF documents more flexible and readable on various devices with reflowable layouts. Implement ReflowView in your project using UWP Tools framework for easy conversion to HTML files.

Reflow makes the document more flexible and easier to read, especially on small devices. Apryse is able to extract the reflowable layout of each page in a PDF document to an HTML file. First, we explain how simple it is to show a widget that allows the user to swipe left or right through the pages of the document to see reflowable document pages. Then, we provide the methods necessary for converting a hard-layout PDF page to an HTML document page.

![](https://3246663708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Frgmys2szYV2Z567Zu3vi%2Fuploads%2Fgit-blob-4fddb7b59986675970ca650338f0089c872bde75%2F70dbef18efe23092b46013bda3ee7e24e7f1a1e7-513x490.gif?alt=media)

### Implementation

To begin using the UWP Tools framework, you must first add the libraries [PDFTron.UWP](https://www.nuget.org/packages/PDFTron.UWP/) and [PDFTron.UWP.Tools](https://www.nuget.org/packages/PDFTron.UWP.Tools/) to your project.

{% hint style="info" %}
The examples provided below use the Model-view-viewmodel (MVVM) architectural pattern.
{% endhint %}

### Step 1: Create ReflowView Instance

Start by creating a [`pdftron.PDF.Tools.Controls.ReflowView`](https://sdk.apryse.com/api/uwp/tools/api/pdftron.PDF.Tools.Controls.ReflowView.html) instance, prepare a new binding in your UI and define this in your viewmodel. For example:

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

```xml
<Border Child="{Binding ReflowViewCtrl}" />
```

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

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

```csharp
private pdftron.PDF.Tools.Controls.ReflowView _reflowViewCtrl;
public pdftron.PDF.Tools.Controls.ReflowView ReflowViewCtrl 
{ 
    get { return _reflowViewCtrl; }
    set { _reflowViewCtrl = value;} 
}
```

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

### Step 2: Initialize ReflowView

Then, you need to attach a [`pdftron.PDF.PDFDoc`](https://sdk.apryse.com/api/PDFTronSDK/dotnetcore/api/pdftron.PDF.PDFDoc.html) to the reflow view control with [`pdftron.PDF.Tools.Controls.ReflowView`](https://sdk.apryse.com/api/uwp/tools/api/pdftron.PDF.Tools.Controls.ReflowView.html#pdftron_PDF_Tools_Controls_ReflowView__ctor_PDFDoc_System_Int32_):

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

```csharp
PDFDoc doc = new PDFDoc("myPDF.pdf");
_reflowViewCtrl = new ReflowView(doc, 1); // setting pageNumber to 1 will reflow the first page of the document
```

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

To cancel all reflow requests, call [`pdftron.PDF.cancelAllRequests()`](https://sdk.apryse.com/api/uwp/guides/html/cb5c1066-a4d9-3bc0-9cc0-611e27d410a5.htm).

Finally, if you want to clear all HTML files created in the cache, you may need to call [`pdftron.PDF.clearCache()`](https://sdk.apryse.com/api/uwp/guides/html/6fa14cf1-d28e-99b0-7e02-f8632ae4e94e.htm).

You can also check a [`sample project`](https://github.com/ApryseSDK/pdftron-uwp-samples/tree/master/PDFViewerReflow/) that implements the ReflowView.


---

# 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/uwp/viewer/reflow.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.
