> 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/android/viewer/view-mode.md).

# View mode (Android)

Discover how to optimize your view modes for an optimal presentation with PDFViewCtrl. Learn about different page layouts and presentation modes to enhance your user experience. The Apryse Xamarin SDK

There are a few view modes which can be adjusted to provide an optimal presentation such as layout, fit, or reflow. Additionally, you can present a view mode dialog allowing a user to change these settings.

{% tabs %}
{% tab title="Layout" %}

## Page layout/presentation mode

[`PDFViewCtrl`](https://sdk.apryse.com/api/xamarinandroid/pdfnet/api/pdftron.PDF.PDFViewCtrl.html) supports a number of page layouts ([presentation modes](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/PDFViewCtrl.PagePresentationMode.html)), as listed below:

| Page presentation mode (Xamarin.Android / Xamarin.iOS)                                                              | Description                                                                                             |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `PDFViewCtrl.PagePresentationModes.Single` / `pdftron.PDF.PagePresentationModes.e_single_page`                      | Displays one page at a time, swiping left and right to change pages.                                    |
| `PDFViewCtrl.PagePresentationModes.SingleCont` / `pdftron.PDF.PagePresentationModes.e_single_continuous`            | Displays one page at a time, scrolling up and down to change pages.                                     |
| `PDFViewCtrl.PagePresentationModes.SingleVert`(Android)                                                             | Displays one page at a time, swiping up and down to change pages.                                       |
| `PDFViewCtrl.PagePresentationModes.Facing` / `pdftron.PDF.PagePresentationModes.e_facing`                           | Displays two pages at a time, with odd-numbered pages on left, swiping left and right to change pages.  |
| `PDFViewCtrl.PagePresentationModes.FacingCont` / `pdftron.PDF.PagePresentationModes.e_facing_continuous`            | Displays pages in two columns, with odd-numbered pages on left, scrolling up and down to change pages.  |
| `PDFViewCtrl.PagePresentationModes.FacingVert`(Android)                                                             | Displays two pages at a time, with odd-numbered pages on left, swiping up and down to change pages.     |
| `PDFViewCtrl.PagePresentationModes.FacingCover` / `pdftron.PDF.PagePresentationModes.e_facing_cover`                | Displays two pages at a time, with odd-numbered pages on right, swiping left and right to change pages. |
| `PDFViewCtrl.PagePresentationModes.FacingCoverCont` / `pdftron.PDF.PagePresentationModes.e_facing_continuous_cover` | Display pages in two columns, with odd-numbered pages on right, scrolling up and down to change pages.  |
| `PDFViewCtrl.PagePresentationModes.FacingCoverVert`(Android)                                                        | Displays two pages at a time, with odd-numbered pages on right, swiping up and down to change pages.    |

## Set the page presentation mode

You can set page presentation mode in your `PDFViewCtrl` by using `PagePresentationMode` property:

{% code lineNumbers="true" %}

```csharp
// Xamarin.Android
mPdfViewCtrl.PagePresentationMode = pdftron.PDF.PDFViewCtrl.PagePresentationModes.Facing;

// Xamarin.iOS
mPdfViewCtrl.PagePresentationMode = pdftron.PDF.PagePresentationModes.e_facing;
```

{% endcode %}
{% endtab %}

{% tab title="Fit" %}

## Page fit & default zoom mode in Android

[`PDFViewCtrl`](https://sdk.apryse.com/api/xamarinandroid/pdfnet/api/pdftron.PDF.PDFViewCtrl.html)'s page view mode controls the default zoom level of pages and documents. New documents will automatically open at the zoom level specified by the mode.

## Page view modes

`PDFViewCtrl` supports the following page view modes:

| Page view mode (Xamarin.Android / Xamarin.iOS)                                   | Description                                                            | Screenshot-portrait                                                                                                                                                                                                                              | Screenshot-landscape                                                                                                                                                                                                                             |
| -------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `PDFViewCtrl.PageViewModes.FitPage` / `pdftron.PDF.PageViewModes.e_fit_page`     | The zoom is set so that the entire page is visible without scrolling.  | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-75dac026a54c93293e068ea0126e7b2254223347%2F3bc90440e459b1e155b0f9a9a7b9f754b42cd5a3-1226x2502.png?alt=media) | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-59ee3c57818fc825dd337857ea392d65db11b26e%2F841cc04ecb1c2ef5520ce434ba27648c5bbaa084-2502x1226.png?alt=media) |
| `PDFViewCtrl.PageViewModes.FitWidth` / `pdftron.PDF.PageViewModes.e_fit_width`   | The zoom is set so that the page's width matches the viewer's width.   | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-75dac026a54c93293e068ea0126e7b2254223347%2F3bc90440e459b1e155b0f9a9a7b9f754b42cd5a3-1226x2502.png?alt=media) | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-74b859d92340e86d05d9af23069457d040ecbea5%2F42f381b7f550ab570da82f3afa419094122b4fd6-2502x1226.png?alt=media) |
| `PDFViewCtrl.PageViewModes.FitHeight` / `pdftron.PDF.PageViewModes.e_fit_height` | The zoom is set so that the page's height matches the viewer's height. | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-79b17d5d72e78c79c78f49f46ce25c5551cfc569%2Fb5d49d5c12472369c3a26dacaeb96562b27c6b86-1226x2502.png?alt=media) | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-59ee3c57818fc825dd337857ea392d65db11b26e%2F841cc04ecb1c2ef5520ce434ba27648c5bbaa084-2502x1226.png?alt=media) |
| `PDFViewCtrl.PageViewModes.Zoom` / `pdftron.PDF.PageViewModes.e_zoom`            | The viewer's zoom is not adjusted based on the page.                   | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-572196d94e5fa9ef10e4f80437b30d02f03c79b8%2Ff75a6a20b2eff23f7081d162d834b79adc01cf57-1226x2502.png?alt=media) | ![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-0919e301109558a25e8cd471fdaaa13fafef21aa%2F0ac86387d778f0aa34b4652898261bdfa4813f8a-2502x1226.png?alt=media) |

## Set the default page fit mode

You can set a default page fit mode in your `PDFViewCtrl` by using `PageRefViewMode` property.

## Set the page fit mode dynamically

If you want to dynamically change the page fit mode, use `PageViewMode` property. Note that when the user flips the page, the page view mode will be automatically reset to the default mode set by `PageRefViewMode`.

{% code lineNumbers="true" %}

```csharp
// Xamarin.Android
mPdfViewCtrl.PageViewMode = pdftron.PDF.PDFViewCtrl.PageViewModes.FitPage;

// Xamarin.iOS
mPdfViewCtrl.PageViewMode = pdftron.PDF.PageViewModes.FitPage;
```

{% endcode %}
{% endtab %}

{% tab title="Reflow" %}

## Reflow document content in Android

{% 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:

{% code lineNumbers="true" %}

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

{% endcode %}

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

{% code lineNumbers="true" %}

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

{% endcode %}

### Scrolling direction

{% code lineNumbers="true" %}

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

{% endcode %}

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:

### 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:

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

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)
{% endtab %}

{% tab title="Dialog" %}

## View mode dialog

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

[`ViewModePickerDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html) allows users to: [pick page layout mode](#layout), [select page color mode](/xamarin/guides/android/viewer/themes.md#custom), [rotate pages](/xamarin/guides/android/manipulation/rotate-pages.md#ui-component), and [crop pages](/xamarin/guides/android/manipulation/rotate-pages.md#ui-component).

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-7b175a1e703e24bfaff14fd21ae65dfa59f8c494%2F5fc71d5279a47e45b78afc52cb32a2297b109b90-1080x2220.png?alt=media)

## Show view mode dialog

To show a view mode dialog in your activity, create a new instance of [`ViewModePickerDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html) by calling `newInstance(PagePresentationMode, boolean, boolean, int)`:

{% code lineNumbers="true" %}

```csharp
public void ShowViewModeDialog()
{
    var viewModeDialog = pdftron.PDF.Dialog.ViewModePickerDialogFragment.NewInstance(mPdfViewCtrl.PagePresentationMode,
      false, mReflowControl.Visibility == ViewStates.Visible, 0);
    viewModeDialog.SetStyle((int)DialogFragmentStyle.Normal, Resource.Style.PDFTronAppTheme);
    viewModeDialog.Show(this.SupportFragmentManager, "view_mode_picker");
}
```

{% endcode %}

## Set view mode dialog listener

In order to let users pick PDF page presentation mode, color mode, etc. you need to implement the corresponding [events](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html#events) in the [`ViewModePickerDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html) instance.

{% code lineNumbers="true" %}

```csharp
viewModeDialog.CustomColorModeSelected += (sender, e) =>
{
    // save the selection so we can retrieve it next time
    PdfViewCtrlSettingsManager.SetCustomColorModeBGColor(this, e.BgColor);
    PdfViewCtrlSettingsManager.SetCustomColorModeTextColor(this, e.TxtColor);
    PdfViewCtrlSettingsManager.SetColorMode(this, PdfViewCtrlSettingsManager.KeyPrefColorModeCustom);
    // Do something with e.BgColor and e.TxtColor
};

viewModeDialog.ViewModeColorSelected += (sender, e) =>
{
    // save the selection so we can retrieve it next time
    PdfViewCtrlSettingsManager.SetColorMode(this, e.ColorMode);
    // Do something with e.ColorMode
};

viewModeDialog.ViewModeSelected += (sender, e) =>
{
    // Do something with e.ViewMode
};
```

{% endcode %}

In [`ViewModeSelected`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.ViewModePickerDialogFragment.html#pdftron_PDF_Dialog_ViewModePickerDialogFragment_ViewModeSelected), the selected view mode values are defined in `PdfViewCtrlSettingsManager` and include the following:

| **View Mode**                              | **Description**                                                                             | **Value**           |
| ------------------------------------------ | ------------------------------------------------------------------------------------------- | ------------------- |
| `KEY_PREF_VIEWMODE_CONTINUOUS_VALUE`       | Single page in continuous mode is selected.                                                 | "continuous"        |
| `KEY_PREF_VIEWMODE_SINGLEPAGE_VALUE`       | Single page presentation mode is selected.                                                  | "singlepage"        |
| `KEY_PREF_VIEWMODE_FACING_VALUE`           | Facing two pages presentation mode is selected.                                             | "facing"            |
| `KEY_PREF_VIEWMODE_FACINGCOVER_VALUE`      | Facing two pages with odd page number on right side of PDF is selected.                     | "facingcover"       |
| `KEY_PREF_VIEWMODE_FACING_CONT_VALUE`      | In continuous mode, Facing two pages presentation mode is selected.                         | "facing\_cont"      |
| `KEY_PREF_VIEWMODE_FACINGCOVER_CONT_VALUE` | In continuous mode, Facing two pages with odd page number on right side of PDF is selected. | "facingcover\_cont" |
| `KEY_PREF_VIEWMODE_ROTATION_VALUE`         | Rotate pdf pages is selected.                                                               | "rotation"          |
| `KEY_PREF_VIEWMODE_USERCROP_VALUE`         | User-level crop pages is selected.                                                          | "user\_crop"        |

To learn about setting page presentation mode, see [PDFViewCtrl page presentation mode ](#layout).

{% hint style="info" %}
To learn about setting page color mode, see [PDFViewCtrl color modes ](/xamarin/guides/android/viewer/themes.md#custom).
{% endhint %}

{% hint style="info" %}
To learn about reflow, see [reflow ](#reflow).
{% endhint %}

{% hint style="info" %}
To learn about cropping pages, see [crop page dialog ](/xamarin/guides/android/manipulation/rotate-pages.md#ui-component).
{% endhint %}
{% 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/android/viewer/view-mode.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.
