> 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/basic-operations/basics/reflow.md).

# Reflow document content in Xamarin

Learn how to create a reflowable layout for PDF documents in Xamarin.Android. Implement a reflow pager for easy document navigation and customization options like text size and background color. The A

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

{% hint style="warning" %}
For Android, available in the full version of the library only. See [Apryse full or standard?](/xamarin/get-started/faq/full-vs-standard.md)
{% endhint %}

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.

## Show reflow pager

[`ReflowControl`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.ReflowControl.html) is a [`ViewPager`](https://developer.android.com/reference/androidx/viewpager/widget/ViewPager.html) that allows the user to flip left and right through the reflowable layout of pages in a PDF document.

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-f03bfe4d5e6fe423c4b72b7a76791f9b6f3e68a9%2F4e9b3c8506de07be2f021529c67611ffbc4dce53-600x1067.gif?alt=media)

### Implementation

To set up your layout with `ReflowControl`, add a `<ReflowControl>` element to your XML layout. For example, if each page in the swipe view should consume the entire layout, then your layout looks like this:

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

```xml
<pdftron.PDF.Controls.ReflowControl android:id="@+id/reflow" android:layout_width="match_parent" android:layout_height="match_parent" />
```

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

Then, you need to attach a [`PDFDoc`](https://sdk.apryse.com/api/xamarinandroid/pdfnet/api/pdftron.PDF.PDFDoc.html) to the reflow pager:

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

```csharp
var reflowControl = FindViewById<ReflowControl>(Resource.Id.reflow);
reflowControl.Setup(pdfDoc);
```

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

### Scrolling direction

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

```csharp
// horizontal (default)
reflowControl.Orientation = ReflowControl.Horizontal;
// vertical
reflowControl.Orientation = ReflowControl.Vertical;
```

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

That is everything you need to have a simple reflow pager.

### Notify the reflow pager that the document has been modified

To refresh the reflow pager to show the latest changes on your document, you should let the reflow pager know that the document has been modified:

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

```csharp
void NotifyReflowModified(ReflowControl reflowControl)
{
    if (reflowControl != null && reflowControl.IsReady) {
        reflowControl.NotifyPagesModified();
    }
}
```

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

### Set the text size

It is possible to change the size of reflowable text. The default text size is `100`; valid values are `5`, `10`, `25`, `50`, `75`, `100`, `125`, `150`, `200`, `400`, `800`, and `1600`. See the following code as an example:

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

```csharp
void ChangeReflowSize(ReflowControl reflowControl, int percent)
{
    if (reflowControl != null && reflowControl.IsReady)
    {
        reflowControl.TextSizeInPercent = percent;
    }
}
```

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

Alternatively, you can zoom in/out to change the reflowable text size:

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

```csharp
void ZoomReflow(ReflowControl reflowControl, bool zoomIn)
{
    if (reflowControl != null && reflowControl.IsReady) {
        if (zoomIn) {
            reflowControl.ZoomIn();
        } else {
            reflowControl.ZoomOut();
        }
    }
}
```

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

Assuming the current text size is 100%, by calling zoomReflow(reflowControl, true) and zoomReflow(reflowControl, false) the new text size will be 125% and 75% of the original size, respectively.

### Set background color

There are three methods to change the background color:

`setDayMode()`: no background

`setNightMode()`: night background

`setCustomColorMode(int)`: customized background

### Set right-to-left direction

You can support right-to-left (RTL) languages by setting the direction of reflowable text by calling [`RightToLeftDirection`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Controls.NativeReflowControl.html#pdftron_PDF_Controls_NativeReflowControl_RightToLeftDirection)


---

# 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/xamarin/basic-operations/basics/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.
