Some test text!

Search
Hamburger Icon

Android / Guides

Rotate a page

There are two options to rotate a page. First is using a UI component that can rotate at 90 degree angles. Second is an API guide to programmatically rotate a page.

API to programmatically rotate pages in Android

To rotate a page in a PDF document.

PDFDoc doc = new PDFDoc(filename);

// Rotate the first page 90 degrees clockwise.
Page page = doc.getPage(1);
int originalRotation = page.getRotation();
int rotation;
switch (originalRotation)
{
  case Page.e_0:   rotation = Page.e_90;  break;
  case Page.e_90:  rotation = Page.e_180; break;
  case Page.e_180: rotation = Page.e_270; break;
  case Page.e_270: rotation = Page.e_0;   break;
  default:         rotation = Page.e_0;   break;
}
page.setRotation(rotation);

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.

Get the answers you need: Chat with us