> 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/manipulation/rotate-pages.md).

# Rotate pages (Android)

Learn how to rotate document pages in Android using a graphical UI or programmatically with Xamarin.Android. Rotate pages by 90, 180, or 270 degrees and display thumbnails at selected angles. API guid

You can change the rotational alignment of pages with a graphical UI or programmatically.

{% tabs %}
{% tab title="UI component" %}

## Rotate document pages in Android

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

The [`RotateDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.RotateDialogFragment.html) allows users to rotate pages of the opened document by 90, 180 and 270 degrees. It also displays a thumbnail of the current page at the selected rotation angle.

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

## Show rotate page dialog

To show a rotate pages dialog in your activity, create a new instance of [`RotateDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.RotateDialogFragment.html) by calling `newInstance()` and setting the [`PDFViewCtrl`](https://sdk.apryse.com/api/xamarinandroid/pdfnet/api/pdftron.PDF.PDFViewCtrl.html):

{% code lineNumbers="true" %}

```csharp
public void showRotateDialog()
{
    pdftron.PDF.Dialog.RotateDialogFragment.NewInstance()
        .SetPdfViewCtrl(mPdfViewCtrl)
        .Show(this.SupportFragmentManager, "rotate_pages_dialog");
}
```

{% endcode %}
{% endtab %}

{% tab title="API guide" %}

## API to programmatically rotate pages in Android

To rotate a page in a PDF document.

{% code lineNumbers="true" %}

```csharp
PDFDoc doc = new PDFDoc(filename);

// Rotate the first page 90 degrees clockwise.
Page page = doc.GetPage(1);
Page.Rotate originalRotation = page.GetRotation();
Page.Rotate rotation;
switch (originalRotation)
{
  case Page.Rotate.e_0:   rotation = Page.Rotate.e_90;  break;
  case Page.Rotate.e_90:  rotation = Page.Rotate.e_180; break;
  case Page.Rotate.e_180: rotation = Page.Rotate.e_270; break;
  case Page.Rotate.e_270: rotation = Page.Rotate.e_0;   break;
  default:                rotation = Page.Rotate.e_0;   break;
}
page.SetRotation(rotation);
```

{% endcode %}

## About rotating pages

A page can be rotated clockwise, by 90 degrees, when displayed or printed. The `Page.GetRotation()` method returns the `Page.Rotate` enum specifying the current rotation. Similarly, `Page.SetRotation()` sets the current rotation.
{% 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/manipulation/rotate-pages.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.
