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

# Rotating a PDF page on iOS

Learn how to rotate pages in a PDF document with ease. Find out how to rotate pages clockwise by 90 degrees for better display and printing. Discover the Page.GetRotation() and Page.SetRotation() meth

To rotate a page in a PDF document.

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

```objc
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];

// Rotate the first page 90 degrees clockwise.
PTPage *page = [doc GetPage:1];
PTRotate originalRotation = [page getRotation];
PTRotate rotation;
switch (originalRotation)
{
  case e_pt0:   rotation = e_pt90;  break;
  case e_pt90:  rotation = e_pt180; break;
  case e_pt180: rotation = e_pt270; break;
  case e_pt270: rotation = e_pt0;   break;
  default:      rotation = e_pt0;   break;
}
[page SetRotation: rotation];
```

{% endcode %}
{% endtab %}

{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)

// Rotate the first page 90 degrees clockwise.
let page: PTPage = doc.getPage(1)
let originalRotation: PTRotate = page.getRotation()
var rotation: PTRotate
switch (originalRotation)
{
  case e_pt0:   rotation = e_pt90
  case e_pt90:  rotation = e_pt180
  case e_pt180: rotation = e_pt270
  case e_pt270: rotation = e_pt0
  default:      rotation = e_pt0
}
page.setRotation(rotation)
```

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

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


---

# 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/ios/page-manipulation/rotate.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.
